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

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

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

n = A("n")
g = B("g")
k = C("k")
j = A("j")
d = C("d")
m = C("m")
a = B("a")
h = A("h")
e = B("e")
l = C("l")

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

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

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

n = A("n")
g = B("g")
k = C("k")
j = A("j")
d = C("d")
m = C("m")
a = B("a")
h = A("h")
e = B("e")
l = C("l")

n.x = e
n.u = g
n.o = l
g.q = d
g.u = n
k.w = e
k.s = l
j.x = e
j.u = e
j.o = m
d.w = a
d.s = l
m.w = g
m.s = l
a.q = m
a.u = n
h.x = g
h.u = e
h.o = d
e.q = l
e.u = j
l.w = e
l.s = d
assert l.s.w.q.w.u.o.s.txt == "d"