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

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

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

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

h = A("h")
m = B("m")
a = C("a")
n = D("n")
j = D("j")
e = C("e")

h.p = n
h.o = a
h.r = m
m.v = h
m.q = j
m.x = a
a.r = e
a.u = e
a.s = h
a.w = n
n.y = m
j.y = m
e.r = a
e.u = a
e.s = h
e.w = n
assert a.r.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.o: C = None
        self.r: B = None
        self.txt = txt

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

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

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

h = A("h")
m = B("m")
a = C("a")
n = D("n")
j = D("j")
e = C("e")

h.p = n
h.o = a
h.r = m
m.v = h
m.q = j
m.x = a
a.r = e
a.u = e
a.s = h
a.w = n
n.y = m
j.y = m
e.r = a
e.u = a
e.s = h
e.w = n
assert a.r.u.u.u.txt == "a"