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

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

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

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

n = A("n")
l = B("l")
i = C("i")
b = D("b")

n.v = b
n.x = l
l.t = i
l.z = i
l.w = i
l.v = n
i.z = b
i.t = b
b.p = i
b.s = n
b.y = n
assert l.w.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.x: B = None
        self.txt = txt

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

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

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

n = A("n")
l = B("l")
i = C("i")
b = D("b")

n.v = b
n.x = l
l.t = i
l.z = i
l.w = i
l.v = n
i.z = b
i.t = b
b.p = i
b.s = n
b.y = n
assert l.w.z.y.txt == "n"