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

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

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

l = A("l")
k = B("k")
n = C("n")
c = C("c")

l.z = k
l.x = c
l.y = c
k.z = l
n.s = l
n.u = l
n.z = l
c.s = l
c.u = l
c.z = l
assert l.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: C = None
        self.y: C = None
        self.txt = txt

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

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

l = A("l")
k = B("k")
n = C("n")
c = C("c")

l.z = k
l.x = c
l.y = c
k.z = l
n.s = l
n.u = l
n.z = l
c.s = l
c.u = l
c.z = l
assert l.z.z.z.z.txt == "l"