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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.o: E = None
        self.r: B = None
        self.s: D = None
        self.y: D = None
        self.txt = txt

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

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

n = A("n")
d = B("d")
a = C("a")
e = D("e")
m = E("m")
h = B("h")
c = C("c")
j = D("j")
i = C("i")

n.p = a
d.y = h
a.t = e
a.s = e
a.o = m
a.r = d
a.y = j
e.t = d
e.y = i
m.r = h
m.p = n
h.y = d
c.t = j
c.y = j
c.o = m
c.r = h
c.s = e
j.t = h
j.y = i
i.t = e
i.s = e
i.o = m
i.r = h
i.y = j
assert e.t.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.o: E = None
        self.r: B = None
        self.s: D = None
        self.y: D = None
        self.txt = txt

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

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

n = A("n")
d = B("d")
a = C("a")
e = D("e")
m = E("m")
h = B("h")
c = C("c")
j = D("j")
i = C("i")

n.p = a
d.y = h
a.t = e
a.s = e
a.o = m
a.r = d
a.y = j
e.t = d
e.y = i
m.r = h
m.p = n
h.y = d
c.t = j
c.y = j
c.o = m
c.r = h
c.s = e
j.t = h
j.y = i
i.t = e
i.s = e
i.o = m
i.r = h
i.y = j
assert e.t.y.y.y.y.y.txt == "h"