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

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

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

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

i = A("i")
n = B("n")
k = C("k")
f = D("f")
b = B("b")

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

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

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

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

i = A("i")
n = B("n")
k = C("k")
f = D("f")
b = B("b")

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