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

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

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

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

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

d.u = h
d.t = h
d.q = h
h.u = d
a.x = h
a.w = e
l.p = d
l.y = h
k.u = h
k.t = h
k.q = h
m.u = h
m.t = h
m.q = h
e.u = h
e.t = h
e.q = h
assert m.t.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: B = None
        self.q: B = None
        self.txt = txt

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

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

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

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

d.u = h
d.t = h
d.q = h
h.u = d
a.x = h
a.w = e
l.p = d
l.y = h
k.u = h
k.t = h
k.q = h
m.u = h
m.t = h
m.q = h
e.u = h
e.t = h
e.q = h
assert m.t.u.u.txt == "h"