class A:
    def __init__(self, txt: str):
        self.u: A = 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.t: D = None
        self.o: B = None
        self.txt = txt

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

c = A("c")
k = B("k")
i = C("i")
b = D("b")
m = A("m")
f = C("f")
l = A("l")
n = A("n")
j = D("j")
a = A("a")

c.u = a
k.z = n
i.t = b
i.o = k
b.s = k
b.r = a
m.u = n
f.t = j
f.o = k
l.u = c
n.u = a
j.s = k
j.r = c
a.u = l
assert l.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = 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.t: D = None
        self.o: B = None
        self.txt = txt

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

c = A("c")
k = B("k")
i = C("i")
b = D("b")
m = A("m")
f = C("f")
l = A("l")
n = A("n")
j = D("j")
a = A("a")

c.u = a
k.z = n
i.t = b
i.o = k
b.s = k
b.r = a
m.u = n
f.t = j
f.o = k
l.u = c
n.u = a
j.s = k
j.r = c
a.u = l
assert l.u.u.u.u.u.txt == "a"