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

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

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

h = A("h")
a = B("a")
b = C("b")
g = C("g")
m = A("m")
i = A("i")
e = C("e")
n = A("n")
j = B("j")

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

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

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

h = A("h")
a = B("a")
b = C("b")
g = C("g")
m = A("m")
i = A("i")
e = C("e")
n = A("n")
j = B("j")

h.s = a
a.q = m
a.u = i
b.o = n
b.q = a
b.w = m
g.o = i
g.q = j
g.w = m
m.s = a
i.s = a
e.o = m
e.q = j
e.w = i
n.s = a
j.q = h
j.u = n
assert g.q.q.s.u.s.u.s.u.s.txt == "a"