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

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

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

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

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

d = A("d")
l = B("l")
a = C("a")
e = D("e")
n = E("n")
h = B("h")

d.t = n
d.u = h
l.s = d
l.r = d
l.u = h
l.q = h
l.p = e
a.u = d
a.s = n
a.z = h
a.p = l
e.o = d
n.y = d
n.q = d
n.u = d
h.s = d
h.r = d
h.u = l
h.q = l
h.p = e
assert d.u.s.t.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.u: B = None
        self.txt = txt

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

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

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

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

d = A("d")
l = B("l")
a = C("a")
e = D("e")
n = E("n")
h = B("h")

d.t = n
d.u = h
l.s = d
l.r = d
l.u = h
l.q = h
l.p = e
a.u = d
a.s = n
a.z = h
a.p = l
e.o = d
n.y = d
n.q = d
n.u = d
h.s = d
h.r = d
h.u = l
h.q = l
h.p = e
assert d.u.s.t.q.u.txt == "h"