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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.x: B = None
        self.z: D = None
        self.u: C = None
        self.txt = txt

c = A("c")
e = B("e")
f = C("f")
a = D("a")
j = E("j")

c.w = j
c.p = a
e.q = j
e.p = f
f.q = a
a.p = j
a.v = j
j.w = a
j.z = a
j.x = e
j.u = f
assert c.p.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.p: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.x: B = None
        self.z: D = None
        self.u: C = None
        self.txt = txt

c = A("c")
e = B("e")
f = C("f")
a = D("a")
j = E("j")

c.w = j
c.p = a
e.q = j
e.p = f
f.q = a
a.p = j
a.v = j
j.w = a
j.z = a
j.x = e
j.u = f
assert c.p.p.x.txt == "e"