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

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

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

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

h = A("h")
a = B("a")
c = C("c")
g = D("g")
l = C("l")
f = D("f")
k = B("k")
m = B("m")
d = D("d")

h.u = g
a.w = l
a.x = l
a.t = c
c.u = m
c.p = l
g.q = h
g.r = f
g.p = l
l.u = a
l.p = c
f.q = h
f.r = d
f.p = c
k.w = c
k.x = c
k.t = l
m.w = l
m.t = l
m.x = c
d.q = h
d.r = g
d.p = l
assert d.p.p.p.u.t.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

h = A("h")
a = B("a")
c = C("c")
g = D("g")
l = C("l")
f = D("f")
k = B("k")
m = B("m")
d = D("d")

h.u = g
a.w = l
a.x = l
a.t = c
c.u = m
c.p = l
g.q = h
g.r = f
g.p = l
l.u = a
l.p = c
f.q = h
f.r = d
f.p = c
k.w = c
k.x = c
k.t = l
m.w = l
m.t = l
m.x = c
d.q = h
d.r = g
d.p = l
assert d.p.p.p.u.t.p.u.txt == "a"