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

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

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

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

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

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

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

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

g.q = m
g.y = b
h.y = a
m.v = b
m.s = k
i.q = k
i.y = b
k.v = b
k.s = m
b.v = k
b.s = m
e.q = b
e.y = k
n.q = b
n.y = b
a.y = h
assert e.q.s.s.v.v.v.v.v.s.txt == "m"