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

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

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

h = A("h")
m = B("m")
a = C("a")
k = A("k")
c = B("c")
f = A("f")
n = C("n")
i = C("i")
e = A("e")
g = A("g")

h.o = a
m.s = c
m.v = c
m.q = c
a.o = c
a.t = g
a.w = m
k.o = a
c.s = m
c.v = m
c.q = m
f.o = n
n.o = m
n.w = m
n.t = f
i.o = c
i.w = c
i.t = e
e.o = n
g.o = a
assert a.o.v.q.v.v.q.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

h = A("h")
m = B("m")
a = C("a")
k = A("k")
c = B("c")
f = A("f")
n = C("n")
i = C("i")
e = A("e")
g = A("g")

h.o = a
m.s = c
m.v = c
m.q = c
a.o = c
a.t = g
a.w = m
k.o = a
c.s = m
c.v = m
c.q = m
f.o = n
n.o = m
n.w = m
n.t = f
i.o = c
i.w = c
i.t = e
e.o = n
g.o = a
assert a.o.v.q.v.v.q.v.v.txt == "m"