class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.w: B = None
        self.v: B = None
        self.txt = txt

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

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

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

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

i = A("i")
c = B("c")
a = C("a")
m = D("m")
l = E("l")

i.q = c
i.w = c
i.v = c
c.t = m
c.q = a
c.p = l
a.x = l
m.p = i
l.s = i
l.q = i
l.z = m
l.o = m
assert l.o.p.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.w: B = None
        self.v: B = None
        self.txt = txt

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

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

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

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

i = A("i")
c = B("c")
a = C("a")
m = D("m")
l = E("l")

i.q = c
i.w = c
i.v = c
c.t = m
c.q = a
c.p = l
a.x = l
m.p = i
l.s = i
l.q = i
l.z = m
l.o = m
assert l.o.p.q.p.txt == "l"