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

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

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

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

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

j.o = h
m.z = c
m.s = h
m.o = h
c.z = m
c.y = e
c.x = f
b.z = m
b.p = i
b.v = f
h.z = f
h.s = m
h.o = m
a.o = h
e.o = h
n.z = h
n.p = b
n.v = c
i.z = h
i.p = n
i.v = c
f.z = h
f.y = e
f.x = c
assert n.p.v.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

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

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

j.o = h
m.z = c
m.s = h
m.o = h
c.z = m
c.y = e
c.x = f
b.z = m
b.p = i
b.v = f
h.z = f
h.s = m
h.o = m
a.o = h
e.o = h
n.z = h
n.p = b
n.v = c
i.z = h
i.p = n
i.v = c
f.z = h
f.y = e
f.x = c
assert n.p.v.y.o.txt == "h"