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

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

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

e = A("e")
b = B("b")
f = C("f")
c = C("c")
n = A("n")

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

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

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

e = A("e")
b = B("b")
f = C("f")
c = C("c")
n = A("n")

e.u = c
e.t = b
b.v = e
b.u = f
f.z = e
f.u = b
c.z = n
c.u = b
n.u = c
n.t = b
assert b.v.u.z.u.z.txt == "n"