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

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

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

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

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

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

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

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

c.r = i
c.o = n
n.o = i
n.z = c
i.r = f
i.t = c
i.u = c
f.r = i
f.t = c
f.u = c
assert f.u.r.t.r.txt == "i"