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

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

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: C = None
        self.u: C = None
        self.p: C = None
        self.txt = txt

m = A("m")
a = B("a")
k = C("k")
n = D("n")

m.t = k
m.z = k
a.p = k
k.w = n
k.v = m
n.r = a
n.x = k
n.u = k
n.p = k
assert m.z.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: C = None
        self.u: C = None
        self.p: C = None
        self.txt = txt

m = A("m")
a = B("a")
k = C("k")
n = D("n")

m.t = k
m.z = k
a.p = k
k.w = n
k.v = m
n.r = a
n.x = k
n.u = k
n.p = k
assert m.z.v.z.txt == "k"