class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.x: D = None
        self.y: E = None
        self.r: B = None
        self.t: E = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

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

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

l.p = m
l.x = m
l.y = n
l.t = n
l.r = h
a.p = e
a.v = e
a.z = j
a.w = l
e.y = m
e.s = l
m.o = e
j.o = l
j.z = e
n.o = l
n.z = e
h.p = e
h.v = e
h.z = n
h.w = l
assert h.z.o.t.z.s.r.txt == "h"