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

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

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

a = A("a")
n = B("n")
g = C("g")
i = A("i")
m = C("m")
b = A("b")
f = A("f")
c = A("c")
j = A("j")
k = C("k")

a.w = j
a.z = b
a.s = n
n.w = g
n.r = g
g.t = n
g.q = k
i.w = c
i.z = f
i.s = n
m.t = n
m.q = g
b.w = f
b.z = c
b.s = n
f.w = i
f.z = a
f.s = n
c.w = b
c.z = a
c.s = n
j.w = a
j.z = i
j.s = n
k.t = n
k.q = g
assert i.s.w.t.r.q.t.r.t.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: A = None
        self.s: B = None
        self.txt = txt

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

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

a = A("a")
n = B("n")
g = C("g")
i = A("i")
m = C("m")
b = A("b")
f = A("f")
c = A("c")
j = A("j")
k = C("k")

a.w = j
a.z = b
a.s = n
n.w = g
n.r = g
g.t = n
g.q = k
i.w = c
i.z = f
i.s = n
m.t = n
m.q = g
b.w = f
b.z = c
b.s = n
f.w = i
f.z = a
f.s = n
c.w = b
c.z = a
c.s = n
j.w = a
j.z = i
j.s = n
k.t = n
k.q = g
assert i.s.w.t.r.q.t.r.t.w.q.txt == "k"