class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.t: B = None
        self.u: A = None
        self.p: B = None
        self.txt = txt

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

i.w = e
i.u = b
m.y = i
e.w = i
e.p = l
l.x = e
l.q = i
b.z = l
b.t = m
b.p = m
b.u = i
assert i.w.p.x.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.t: B = None
        self.u: A = None
        self.p: B = None
        self.txt = txt

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

i.w = e
i.u = b
m.y = i
e.w = i
e.p = l
l.x = e
l.q = i
b.z = l
b.t = m
b.p = m
b.u = i
assert i.w.p.x.w.txt == "i"