class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.v: C = None
        self.o: C = None
        self.txt = txt

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

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

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

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

i = A("i")
c = B("c")
d = C("d")
j = D("j")
n = E("n")

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

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

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

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

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

i = A("i")
c = B("c")
d = C("d")
j = D("j")
n = E("n")

i.z = d
i.v = d
i.o = d
c.r = i
c.w = d
d.p = j
j.p = i
j.x = d
n.v = i
n.x = d
assert d.p.x.p.txt == "j"