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

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

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

c = A("c")
k = B("k")
l = C("l")
i = B("i")
d = A("d")
e = B("e")
f = C("f")
n = B("n")
j = B("j")

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

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

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

c = A("c")
k = B("k")
l = C("l")
i = B("i")
d = A("d")
e = B("e")
f = C("f")
n = B("n")
j = B("j")

c.s = i
k.u = l
l.z = c
i.u = f
d.s = n
e.u = f
f.z = d
n.u = f
j.u = f
assert d.s.u.z.s.u.txt == "f"