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

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

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

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

k = A("k")
m = B("m")
i = C("i")
h = D("h")
j = D("j")
d = C("d")
f = A("f")
a = A("a")
n = A("n")
e = D("e")

k.x = i
m.u = j
i.s = m
i.o = m
i.t = h
h.p = n
h.q = m
j.p = a
j.q = m
d.s = m
d.o = m
d.t = e
f.x = i
a.x = i
n.x = i
e.p = a
e.q = m
assert d.t.p.x.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

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

k = A("k")
m = B("m")
i = C("i")
h = D("h")
j = D("j")
d = C("d")
f = A("f")
a = A("a")
n = A("n")
e = D("e")

k.x = i
m.u = j
i.s = m
i.o = m
i.t = h
h.p = n
h.q = m
j.p = a
j.q = m
d.s = m
d.o = m
d.t = e
f.x = i
a.x = i
n.x = i
e.p = a
e.q = m
assert d.t.p.x.s.u.txt == "j"