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

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

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

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

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

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

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

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

b.s = g
a.x = i
a.s = d
n.w = a
n.u = h
h.s = m
i.w = a
i.u = h
g.w = k
g.u = b
k.x = i
k.s = a
c.x = m
c.s = a
m.w = k
m.u = b
d.x = i
d.s = k
assert c.s.s.s.s.x.w.s.x.u.txt == "h"