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

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

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

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

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

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

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

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

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

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

a.x = n
a.u = n
a.w = i
k.s = l
k.u = i
k.w = i
k.t = n
n.q = k
h.q = l
h.u = a
i.s = h
i.u = k
i.w = k
i.t = n
l.q = h
l.u = a
assert a.w.u.u.s.txt == "h"