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

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

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

b = A("b")
i = B("i")
e = C("e")
f = C("f")
n = C("n")
a = C("a")
j = C("j")
l = B("l")
m = C("m")
c = C("c")

b.x = j
i.r = l
e.o = n
e.z = l
f.o = m
f.z = i
n.o = m
n.z = i
a.o = e
a.z = l
j.o = a
j.z = l
l.r = i
m.o = a
m.z = l
c.o = m
c.z = l
assert f.z.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

b = A("b")
i = B("i")
e = C("e")
f = C("f")
n = C("n")
a = C("a")
j = C("j")
l = B("l")
m = C("m")
c = C("c")

b.x = j
i.r = l
e.o = n
e.z = l
f.o = m
f.z = i
n.o = m
n.z = i
a.o = e
a.z = l
j.o = a
j.z = l
l.r = i
m.o = a
m.z = l
c.o = m
c.z = l
assert f.z.r.r.txt == "i"