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

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

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

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

d = A("d")
m = B("m")
l = C("l")
k = D("k")
a = D("a")
h = C("h")
j = A("j")
b = D("b")

d.y = m
d.z = m
m.z = h
l.z = a
l.q = a
l.x = k
l.o = m
k.u = a
a.u = b
h.z = a
h.q = a
h.x = k
h.o = m
j.y = m
j.z = m
b.u = a
assert m.z.x.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: B = None
        self.txt = txt

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

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

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

d = A("d")
m = B("m")
l = C("l")
k = D("k")
a = D("a")
h = C("h")
j = A("j")
b = D("b")

d.y = m
d.z = m
m.z = h
l.z = a
l.q = a
l.x = k
l.o = m
k.u = a
a.u = b
h.z = a
h.q = a
h.x = k
h.o = m
j.y = m
j.z = m
b.u = a
assert m.z.x.u.u.u.u.u.txt == "a"