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

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: A = None
        self.y: C = None
        self.w: E = None
        self.txt = txt

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

i = A("i")
j = B("j")
b = C("b")
c = D("c")
k = E("k")

i.p = b
j.o = k
j.z = c
b.w = k
c.r = b
c.y = b
c.x = i
c.w = k
k.x = b
k.v = j
assert i.p.w.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: A = None
        self.y: C = None
        self.w: E = None
        self.txt = txt

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

i = A("i")
j = B("j")
b = C("b")
c = D("c")
k = E("k")

i.p = b
j.o = k
j.z = c
b.w = k
c.r = b
c.y = b
c.x = i
c.w = k
k.x = b
k.v = j
assert i.p.w.v.z.txt == "c"