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

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

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

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

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

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

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

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

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

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

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