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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

m = A("m")
l = B("l")
k = C("k")
h = D("h")
g = E("g")
f = C("f")
n = D("n")
i = E("i")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

m = A("m")
l = B("l")
k = C("k")
h = D("h")
g = E("g")
f = C("f")
n = D("n")
i = E("i")

m.s = n
m.z = h
l.x = g
l.o = k
k.y = n
h.o = l
h.q = i
h.p = g
g.q = l
f.y = h
n.o = l
n.q = i
n.p = i
i.q = l
assert l.x.q.o.y.q.q.txt == "l"