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

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

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

c = A("c")
j = B("j")
f = C("f")
l = A("l")
e = B("e")

c.s = j
j.s = e
j.z = e
j.x = f
f.x = e
l.s = j
e.s = j
e.z = j
e.x = f
assert e.s.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

c = A("c")
j = B("j")
f = C("f")
l = A("l")
e = B("e")

c.s = j
j.s = e
j.z = e
j.x = f
f.x = e
l.s = j
e.s = j
e.z = j
e.x = f
assert e.s.x.x.x.x.txt == "e"