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

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

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

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

k = A("k")
d = B("d")
b = C("b")
h = D("h")
n = B("n")
j = D("j")
m = B("m")
l = A("l")
i = D("i")

k.s = h
d.s = l
b.u = n
h.t = j
h.z = n
h.p = b
n.s = k
j.t = i
j.z = d
j.p = b
m.s = k
l.s = i
i.t = j
i.z = m
i.p = b
assert m.s.s.t.t.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

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

k = A("k")
d = B("d")
b = C("b")
h = D("h")
n = B("n")
j = D("j")
m = B("m")
l = A("l")
i = D("i")

k.s = h
d.s = l
b.u = n
h.t = j
h.z = n
h.p = b
n.s = k
j.t = i
j.z = d
j.p = b
m.s = k
l.s = i
i.t = j
i.z = m
i.p = b
assert m.s.s.t.t.z.s.txt == "k"