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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: D = None
        self.z: E = None
        self.y: E = None
        self.w: E = None
        self.txt = txt

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

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

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

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

h.p = a
f.x = l
f.u = m
f.z = n
f.y = e
f.w = e
l.o = e
l.t = e
m.x = h
m.w = e
m.p = e
e.q = n
e.u = n
n.q = e
n.u = e
a.x = h
a.w = e
a.p = e
assert l.t.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: D = None
        self.z: E = None
        self.y: E = None
        self.w: E = None
        self.txt = txt

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

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

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

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

h.p = a
f.x = l
f.u = m
f.z = n
f.y = e
f.w = e
l.o = e
l.t = e
m.x = h
m.w = e
m.p = e
e.q = n
e.u = n
n.q = e
n.u = e
a.x = h
a.w = e
a.p = e
assert l.t.u.u.txt == "e"