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

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

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

n = A("n")
b = B("b")
f = C("f")
i = C("i")
l = A("l")
g = A("g")
e = C("e")
k = A("k")
d = A("d")
a = B("a")

n.q = g
n.v = b
b.z = k
b.w = e
b.y = a
f.y = b
f.s = k
i.y = b
i.s = g
l.q = k
l.v = b
g.q = d
g.v = b
e.y = b
e.s = l
k.q = n
k.v = b
d.q = g
d.v = a
a.z = k
a.w = e
a.y = b
assert a.y.z.v.z.v.w.y.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.v: B = None
        self.txt = txt

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

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

n = A("n")
b = B("b")
f = C("f")
i = C("i")
l = A("l")
g = A("g")
e = C("e")
k = A("k")
d = A("d")
a = B("a")

n.q = g
n.v = b
b.z = k
b.w = e
b.y = a
f.y = b
f.s = k
i.y = b
i.s = g
l.q = k
l.v = b
g.q = d
g.v = b
e.y = b
e.s = l
k.q = n
k.v = b
d.q = g
d.v = a
a.z = k
a.w = e
a.y = b
assert a.y.z.v.z.v.w.y.z.q.txt == "n"