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

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

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

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

h = A("h")
e = B("e")
c = C("c")
m = D("m")
i = C("i")
g = B("g")
l = B("l")
j = B("j")
n = B("n")
b = D("b")

h.p = c
h.z = m
e.x = c
e.u = h
e.o = h
e.r = m
c.q = m
m.s = h
m.z = b
m.r = b
m.o = j
i.q = b
g.x = i
g.u = h
g.o = h
g.r = b
l.x = c
l.u = h
l.o = h
l.r = b
j.x = c
j.u = h
j.o = h
j.r = b
n.x = c
n.u = h
n.o = h
n.r = m
b.s = h
b.z = m
b.r = m
b.o = l
assert m.o.x.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: D = None
        self.txt = txt

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

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

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

h = A("h")
e = B("e")
c = C("c")
m = D("m")
i = C("i")
g = B("g")
l = B("l")
j = B("j")
n = B("n")
b = D("b")

h.p = c
h.z = m
e.x = c
e.u = h
e.o = h
e.r = m
c.q = m
m.s = h
m.z = b
m.r = b
m.o = j
i.q = b
g.x = i
g.u = h
g.o = h
g.r = b
l.x = c
l.u = h
l.o = h
l.r = b
j.x = c
j.u = h
j.o = h
j.r = b
n.x = c
n.u = h
n.o = h
n.r = m
b.s = h
b.z = m
b.r = m
b.o = l
assert m.o.x.q.s.txt == "h"