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

class B:
    def __init__(self, txt: str):
        self.r: B = None
        self.u: B = None
        self.o: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: A = None
        self.x: C = None
        self.txt = txt

k = A("k")
i = B("i")
e = C("e")
c = A("c")
n = B("n")
j = C("j")
d = A("d")
f = C("f")
b = C("b")

k.z = b
k.q = i
k.t = i
i.r = n
i.u = n
i.o = d
e.q = f
e.y = k
e.x = b
c.z = b
c.q = n
c.t = n
n.r = i
n.u = i
n.o = d
j.q = b
j.y = c
j.x = f
d.z = b
d.q = n
d.t = n
f.q = j
f.y = d
f.x = e
b.q = e
b.y = c
b.x = f
assert d.z.q.q.q.q.q.y.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: B = None
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: B = None
        self.u: B = None
        self.o: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: A = None
        self.x: C = None
        self.txt = txt

k = A("k")
i = B("i")
e = C("e")
c = A("c")
n = B("n")
j = C("j")
d = A("d")
f = C("f")
b = C("b")

k.z = b
k.q = i
k.t = i
i.r = n
i.u = n
i.o = d
e.q = f
e.y = k
e.x = b
c.z = b
c.q = n
c.t = n
n.r = i
n.u = i
n.o = d
j.q = b
j.y = c
j.x = f
d.z = b
d.q = n
d.t = n
f.q = j
f.y = d
f.x = e
b.q = e
b.y = c
b.x = f
assert d.z.q.q.q.q.q.y.z.q.txt == "e"