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

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

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

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

e.t = f
e.v = f
f.z = m
f.u = e
j.u = d
k.u = d
n.u = e
d.t = f
d.v = f
b.z = k
b.u = e
m.u = d
assert f.z.u.v.z.u.v.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: B = None
        self.txt = txt

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

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

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

e.t = f
e.v = f
f.z = m
f.u = e
j.u = d
k.u = d
n.u = e
d.t = f
d.v = f
b.z = k
b.u = e
m.u = d
assert f.z.u.v.z.u.v.z.u.txt == "d"