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

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

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

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

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

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

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

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

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

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

m.s = e
g.y = d
g.o = m
g.s = b
b.y = l
e.u = b
d.s = k
k.u = l
h.u = l
l.y = b
j.y = d
j.o = m
j.s = b
f.y = m
f.o = m
f.s = b
assert d.s.u.y.y.txt == "l"