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

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

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

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

n = A("n")
a = B("a")
l = C("l")
b = D("b")
d = A("d")
k = D("k")
c = B("c")

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

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

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

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

n = A("n")
a = B("a")
l = C("l")
b = D("b")
d = A("d")
k = D("k")
c = B("c")

n.q = l
n.x = l
a.y = b
a.u = d
l.w = b
l.v = a
b.s = l
b.z = c
d.q = l
d.x = l
k.s = l
k.z = c
c.y = b
c.u = d
assert c.y.s.w.s.txt == "l"