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

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

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

f = A("f")
a = B("a")
c = C("c")
g = B("g")
l = B("l")
e = C("e")

f.z = l
f.x = l
a.o = f
a.t = g
c.t = e
g.o = f
g.t = a
l.o = f
l.t = a
e.t = c
assert e.t.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: B = None
        self.txt = txt

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

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

f = A("f")
a = B("a")
c = C("c")
g = B("g")
l = B("l")
e = C("e")

f.z = l
f.x = l
a.o = f
a.t = g
c.t = e
g.o = f
g.t = a
l.o = f
l.t = a
e.t = c
assert e.t.t.t.t.t.txt == "c"