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

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

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

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

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

j.w = n
n.v = j
n.z = j
n.x = i
i.t = j
i.o = n
l.t = j
l.w = i
assert i.t.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

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

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

j.w = n
n.v = j
n.z = j
n.x = i
i.t = j
i.o = n
l.t = j
l.w = i
assert i.t.w.z.txt == "j"