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

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

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

k = A("k")
d = B("d")
e = C("e")
f = B("f")
l = C("l")
a = C("a")

k.u = a
d.y = k
e.s = d
e.x = a
e.z = l
f.y = k
l.s = d
l.x = e
l.z = a
a.s = f
a.x = e
a.z = e
assert l.x.z.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

k = A("k")
d = B("d")
e = C("e")
f = B("f")
l = C("l")
a = C("a")

k.u = a
d.y = k
e.s = d
e.x = a
e.z = l
f.y = k
l.s = d
l.x = e
l.z = a
a.s = f
a.x = e
a.z = e
assert l.x.z.x.x.txt == "a"