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

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: E = None
        self.t: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: C = None
        self.y: F = None
        self.o: F = None
        self.v: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: A = None
        self.o: E = None
        self.q: D = None
        self.txt = txt

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

g.q = d
g.o = a
g.y = f
f.z = i
f.p = a
i.q = f
i.s = d
i.t = a
a.q = i
a.p = i
a.y = k
a.o = k
a.v = g
e.p = f
k.s = g
k.o = e
k.q = a
d.p = f
assert g.q.p.z.q.z.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.o: D = None
        self.y: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: E = None
        self.t: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: C = None
        self.y: F = None
        self.o: F = None
        self.v: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: A = None
        self.o: E = None
        self.q: D = None
        self.txt = txt

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

g.q = d
g.o = a
g.y = f
f.z = i
f.p = a
i.q = f
i.s = d
i.t = a
a.q = i
a.p = i
a.y = k
a.o = k
a.v = g
e.p = f
k.s = g
k.o = e
k.q = a
d.p = f
assert g.q.p.z.q.z.q.z.txt == "i"