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

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

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

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

k = A("k")
f = B("f")
m = C("m")
e = D("e")
g = A("g")
l = A("l")
a = C("a")
b = D("b")
h = B("h")

k.o = b
k.p = l
f.s = b
f.y = h
f.t = m
f.o = g
m.q = b
m.z = b
m.v = k
m.x = h
e.y = b
e.s = h
e.p = f
g.o = e
g.p = k
l.o = b
l.p = g
a.q = e
a.v = k
a.x = h
a.z = b
b.y = e
b.s = h
b.p = h
h.s = b
h.y = f
h.t = m
h.o = l
assert m.x.y.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: A = None
        self.txt = txt

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

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

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

k = A("k")
f = B("f")
m = C("m")
e = D("e")
g = A("g")
l = A("l")
a = C("a")
b = D("b")
h = B("h")

k.o = b
k.p = l
f.s = b
f.y = h
f.t = m
f.o = g
m.q = b
m.z = b
m.v = k
m.x = h
e.y = b
e.s = h
e.p = f
g.o = e
g.p = k
l.o = b
l.p = g
a.q = e
a.v = k
a.x = h
a.z = b
b.y = e
b.s = h
b.p = h
h.s = b
h.y = f
h.t = m
h.o = l
assert m.x.y.s.p.txt == "h"