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

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

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

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

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

h.o = g
d.s = b
d.y = g
g.o = m
l.y = g
l.o = g
l.u = m
l.z = m
i.o = g
f.y = g
f.o = g
f.u = m
f.z = m
b.y = g
b.o = g
b.u = d
b.z = d
k.o = g
a.o = g
m.s = l
m.y = g
assert l.y.o.s.o.o.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

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

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

h.o = g
d.s = b
d.y = g
g.o = m
l.y = g
l.o = g
l.u = m
l.z = m
i.o = g
f.y = g
f.o = g
f.u = m
f.z = m
b.y = g
b.o = g
b.u = d
b.z = d
k.o = g
a.o = g
m.s = l
m.y = g
assert l.y.o.s.o.o.y.o.txt == "m"