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

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

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

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

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

a = A("a")
h = B("h")
n = C("n")
i = D("i")
l = E("l")
j = D("j")
d = D("d")
g = B("g")
k = E("k")
m = A("m")

a.y = m
h.p = g
h.v = i
h.r = j
h.o = j
h.w = n
n.w = g
i.y = g
l.v = g
l.r = a
l.u = m
j.y = h
d.y = h
g.p = h
g.v = i
g.o = i
g.r = j
g.w = n
k.v = g
k.r = a
k.u = a
m.y = a
assert h.v.y.o.y.p.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

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

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

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

a = A("a")
h = B("h")
n = C("n")
i = D("i")
l = E("l")
j = D("j")
d = D("d")
g = B("g")
k = E("k")
m = A("m")

a.y = m
h.p = g
h.v = i
h.r = j
h.o = j
h.w = n
n.w = g
i.y = g
l.v = g
l.r = a
l.u = m
j.y = h
d.y = h
g.p = h
g.v = i
g.o = i
g.r = j
g.w = n
k.v = g
k.r = a
k.u = a
m.y = a
assert h.v.y.o.y.p.o.y.txt == "h"