class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.z: E = None
        self.t: B = None
        self.o: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: A = None
        self.z: A = None
        self.x: E = None
        self.p: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: D = None
        self.x: D = None
        self.p: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

g.q = e
g.z = h
g.o = h
g.t = i
i.o = c
f.u = e
f.y = g
f.z = g
f.x = h
f.p = l
a.q = l
a.x = d
a.p = i
h.z = f
c.z = f
c.t = h
c.y = g
c.x = g
c.v = l
d.q = l
d.x = a
d.p = e
e.o = c
l.q = d
l.x = d
l.p = e
assert a.x.x.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.z: E = None
        self.t: B = None
        self.o: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: A = None
        self.z: A = None
        self.x: E = None
        self.p: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: D = None
        self.x: D = None
        self.p: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

g.q = e
g.z = h
g.o = h
g.t = i
i.o = c
f.u = e
f.y = g
f.z = g
f.x = h
f.p = l
a.q = l
a.x = d
a.p = i
h.z = f
c.z = f
c.t = h
c.y = g
c.x = g
c.v = l
d.q = l
d.x = a
d.p = e
e.o = c
l.q = d
l.x = d
l.p = e
assert a.x.x.x.p.txt == "e"