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

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

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

i = A("i")
g = B("g")
d = C("d")
l = B("l")
n = C("n")
c = C("c")
k = B("k")
a = A("a")
m = C("m")
j = B("j")

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

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

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

i = A("i")
g = B("g")
d = C("d")
l = B("l")
n = C("n")
c = C("c")
k = B("k")
a = A("a")
m = C("m")
j = B("j")

i.u = j
i.q = d
i.o = n
g.r = m
d.o = i
d.w = m
d.s = c
l.r = m
n.o = a
n.w = m
n.s = c
c.o = a
c.w = m
c.s = d
k.r = n
a.u = g
a.q = c
a.o = m
m.o = a
m.w = n
m.s = d
j.r = d
assert c.w.o.u.r.s.w.s.s.txt == "c"