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

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

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

a = A("a")
c = B("c")
b = C("b")
m = C("m")
f = C("f")
k = A("k")
d = B("d")
e = A("e")

a.z = f
a.u = e
c.v = b
b.v = d
b.o = d
b.p = f
m.v = c
m.o = c
m.p = b
f.v = c
f.o = c
f.p = b
k.z = m
k.u = a
d.v = b
e.z = m
e.u = a
assert e.u.u.u.z.p.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.u: A = None
        self.txt = txt

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

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

a = A("a")
c = B("c")
b = C("b")
m = C("m")
f = C("f")
k = A("k")
d = B("d")
e = A("e")

a.z = f
a.u = e
c.v = b
b.v = d
b.o = d
b.p = f
m.v = c
m.o = c
m.p = b
f.v = c
f.o = c
f.p = b
k.z = m
k.u = a
d.v = b
e.z = m
e.u = a
assert e.u.u.u.z.p.p.v.txt == "c"