class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: B = None
        self.v: 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.r: B = None
        self.txt = txt

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

n.t = c
n.v = c
n.z = f
f.o = n
i.r = f
e.t = i
e.z = f
e.v = c
b.t = i
b.z = f
b.v = c
c.r = f
assert f.o.t.r.o.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: B = None
        self.v: 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.r: B = None
        self.txt = txt

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

n.t = c
n.v = c
n.z = f
f.o = n
i.r = f
e.t = i
e.z = f
e.v = c
b.t = i
b.z = f
b.v = c
c.r = f
assert f.o.t.r.o.z.o.txt == "n"