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

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

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

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

f = A("f")
a = B("a")
k = C("k")
l = D("l")

f.w = l
f.u = l
f.v = k
a.z = l
k.v = l
l.x = k
assert l.x.v.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: C = None
        self.u: D = None
        self.txt = txt

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

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

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

f = A("f")
a = B("a")
k = C("k")
l = D("l")

f.w = l
f.u = l
f.v = k
a.z = l
k.v = l
l.x = k
assert l.x.v.x.v.txt == "l"