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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.r: E = None
        self.o: A = None
        self.x: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: C = None
        self.o: C = None
        self.w: D = None
        self.q: D = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.r: E = None
        self.o: A = None
        self.x: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: C = None
        self.o: C = None
        self.w: D = None
        self.q: D = None
        self.txt = txt

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

h.u = i
i.u = l
i.o = l
i.y = d
i.p = h
l.v = h
l.o = h
l.r = a
l.x = i
d.p = h
a.p = l
a.t = l
a.o = l
a.w = d
a.q = d
assert h.u.u.r.q.txt == "d"