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

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

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

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

d = A("d")
a = B("a")
c = C("c")
j = D("j")

d.x = j
d.o = j
d.r = c
d.z = c
a.r = d
a.y = j
a.o = c
a.w = c
c.v = j
j.z = c
j.w = c
j.s = d
j.r = a
assert j.r.r.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.o: D = None
        self.r: C = None
        self.z: C = None
        self.txt = txt

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

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

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

d = A("d")
a = B("a")
c = C("c")
j = D("j")

d.x = j
d.o = j
d.r = c
d.z = c
a.r = d
a.y = j
a.o = c
a.w = c
c.v = j
j.z = c
j.w = c
j.s = d
j.r = a
assert j.r.r.x.r.txt == "a"