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

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

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

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

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

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

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

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

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

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

k.w = i
k.z = b
i.t = e
i.p = n
i.s = n
i.z = b
e.u = b
e.z = n
e.p = n
e.y = k
n.o = b
n.v = i
b.w = i
b.z = k
assert n.o.w.z.z.w.txt == "i"