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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.s: C = None
        self.q: C = None
        self.txt = txt

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

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

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

k.u = l
k.x = l
n.x = l
n.s = l
n.q = l
l.z = k
l.x = k
l.y = i
i.w = k
assert i.w.x.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.x: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.s: C = None
        self.q: C = None
        self.txt = txt

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

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

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

k.u = l
k.x = l
n.x = l
n.s = l
n.q = l
l.z = k
l.x = k
l.y = i
i.w = k
assert i.w.x.x.u.txt == "l"