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

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

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

n = A("n")
l = B("l")
m = C("m")
i = A("i")
f = C("f")
j = C("j")
c = A("c")
b = B("b")
h = B("h")
g = B("g")

n.q = j
l.w = n
m.o = f
m.q = c
m.s = c
i.q = m
f.o = j
f.q = c
f.s = c
j.o = m
j.q = n
j.s = i
c.q = j
b.w = c
h.w = c
g.w = n
assert c.q.o.s.q.s.q.o.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

n = A("n")
l = B("l")
m = C("m")
i = A("i")
f = C("f")
j = C("j")
c = A("c")
b = B("b")
h = B("h")
g = B("g")

n.q = j
l.w = n
m.o = f
m.q = c
m.s = c
i.q = m
f.o = j
f.q = c
f.s = c
j.o = m
j.q = n
j.s = i
c.q = j
b.w = c
h.w = c
g.w = n
assert c.q.o.s.q.s.q.o.o.q.txt == "n"