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

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

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

k = A("k")
a = B("a")
i = C("i")
h = C("h")
b = B("b")
m = C("m")
g = B("g")
n = A("n")
l = C("l")

k.o = h
k.s = a
k.w = n
a.w = m
a.u = m
i.w = k
i.s = k
h.w = n
h.s = k
b.w = l
b.u = i
m.w = n
m.s = k
g.w = l
g.u = l
n.o = m
n.s = a
n.w = k
l.w = n
l.s = n
assert a.w.w.s.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.s: B = None
        self.w: A = None
        self.txt = txt

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

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

k = A("k")
a = B("a")
i = C("i")
h = C("h")
b = B("b")
m = C("m")
g = B("g")
n = A("n")
l = C("l")

k.o = h
k.s = a
k.w = n
a.w = m
a.u = m
i.w = k
i.s = k
h.w = n
h.s = k
b.w = l
b.u = i
m.w = n
m.s = k
g.w = l
g.u = l
n.o = m
n.s = a
n.w = k
l.w = n
l.s = n
assert a.w.w.s.u.s.txt == "k"