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

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: C = None
        self.r: A = None
        self.q: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: C = None
        self.r: A = None
        self.q: C = None
        self.txt = txt

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

c.w = b
c.x = b
c.p = e
c.v = e
j.s = e
e.y = c
b.z = f
b.u = e
b.q = e
b.r = c
f.s = e
assert j.s.y.p.txt == "e"