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

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: A = None
        self.u: A = 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.x: E = None
        self.txt = txt

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

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

i.q = j
i.z = m
i.s = e
m.o = l
m.p = i
m.u = i
e.o = m
j.x = g
g.x = i
g.y = i
g.o = i
g.z = m
l.x = i
l.y = i
l.o = i
l.z = m
assert e.o.o.z.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.z: B = None
        self.s: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: A = None
        self.u: A = 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.x: E = None
        self.txt = txt

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

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

i.q = j
i.z = m
i.s = e
m.o = l
m.p = i
m.u = i
e.o = m
j.x = g
g.x = i
g.y = i
g.o = i
g.z = m
l.x = i
l.y = i
l.o = i
l.z = m
assert e.o.o.z.p.q.txt == "j"