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

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

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

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

i = A("i")
d = B("d")
k = C("k")
f = D("f")

i.s = f
i.x = f
i.o = k
i.u = k
d.y = f
d.z = i
d.v = k
d.w = k
k.u = d
k.z = f
k.s = f
k.r = i
f.o = k
f.u = k
f.z = i
f.r = i
assert i.s.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.x: D = None
        self.o: C = None
        self.u: C = None
        self.txt = txt

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

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

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

i = A("i")
d = B("d")
k = C("k")
f = D("f")

i.s = f
i.x = f
i.o = k
i.u = k
d.y = f
d.z = i
d.v = k
d.w = k
k.u = d
k.z = f
k.s = f
k.r = i
f.o = k
f.u = k
f.z = i
f.r = i
assert i.s.r.x.txt == "f"