class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: C = None
        self.u: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: E = None
        self.w: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: B = None
        self.w: B = None
        self.z: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: E = None
        self.v: D = None
        self.w: D = None
        self.z: A = None
        self.x: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

g = A("g")
m = B("m")
d = C("d")
l = D("l")
i = E("i")
a = F("a")
c = E("c")

g.r = i
m.t = g
m.x = d
m.u = l
d.r = l
d.o = c
d.w = a
l.u = d
l.t = m
l.w = m
l.z = a
i.t = c
i.v = l
i.w = l
i.z = g
i.x = m
a.z = l
c.t = i
c.v = l
c.w = l
c.z = g
c.x = m
assert g.r.v.u.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: C = None
        self.u: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: E = None
        self.w: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: B = None
        self.w: B = None
        self.z: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: E = None
        self.v: D = None
        self.w: D = None
        self.z: A = None
        self.x: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

g = A("g")
m = B("m")
d = C("d")
l = D("l")
i = E("i")
a = F("a")
c = E("c")

g.r = i
m.t = g
m.x = d
m.u = l
d.r = l
d.o = c
d.w = a
l.u = d
l.t = m
l.w = m
l.z = a
i.t = c
i.v = l
i.w = l
i.z = g
i.x = m
a.z = l
c.t = i
c.v = l
c.w = l
c.z = g
c.x = m
assert g.r.v.u.w.z.txt == "l"