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

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

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

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

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

i = A("i")
g = B("g")
f = C("f")
c = D("c")
m = E("m")
j = B("j")
e = D("e")
l = E("l")
b = D("b")

i.s = l
i.o = e
g.z = i
f.o = l
c.y = i
c.s = e
m.z = l
m.y = g
j.z = i
e.y = i
e.s = c
l.z = m
l.y = j
b.y = i
b.s = c
assert m.y.z.s.z.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.o: D = None
        self.txt = txt

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

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

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

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

i = A("i")
g = B("g")
f = C("f")
c = D("c")
m = E("m")
j = B("j")
e = D("e")
l = E("l")
b = D("b")

i.s = l
i.o = e
g.z = i
f.o = l
c.y = i
c.s = e
m.z = l
m.y = g
j.z = i
e.y = i
e.s = c
l.z = m
l.y = j
b.y = i
b.s = c
assert m.y.z.s.z.y.z.txt == "i"