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

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

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

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

c.z = j
c.y = m
j.o = e
j.q = m
k.p = e
k.u = m
k.y = j
m.z = n
m.y = c
n.o = k
n.q = c
f.p = k
f.u = c
f.y = j
i.o = k
i.q = c
e.p = f
e.u = m
e.y = i
assert c.y.y.z.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: A = None
        self.txt = txt

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

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

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

c.z = j
c.y = m
j.o = e
j.q = m
k.p = e
k.u = m
k.y = j
m.z = n
m.y = c
n.o = k
n.q = c
f.p = k
f.u = c
f.y = j
i.o = k
i.q = c
e.p = f
e.u = m
e.y = i
assert c.y.y.z.o.p.txt == "f"