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

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

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

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

c.u = f
i.o = c
a.z = m
a.v = m
a.q = f
k.o = c
m.o = c
n.u = f
f.z = i
f.v = m
f.q = a
assert m.o.u.v.o.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

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

c.u = f
i.o = c
a.z = m
a.v = m
a.q = f
k.o = c
m.o = c
n.u = f
f.z = i
f.v = m
f.q = a
assert m.o.u.v.o.u.v.txt == "m"