import string

al = string.ascii_lowercase


def sd(a, b):
    return cd(a, b) if abs(cd(a, b)) <= abs(ccd(a, b)) else ccd(a, b)


def cd(a, b):
    a = al.index(a)
    b = al.index(b)
    return (b - a + 26) % 26


def ccd(a, b):
    a = al.index(a)
    b = al.index(b)
    return -1 * ((a - b + 26) % 26)


t = int(input())
s = [str(input()) for i in range(t)]
r = []

for i in range(t):
    r.append([])
    s[i] = "a" + s[i]
    for j in range(1, len(s[i])):
        r[i].append(sd(s[i][j - 1], s[i][j]))

    print(" ".join(str(j) for j in r[i]))

import string

al = string.ascii_lowercase


def sd(a, b):
    return cd(a, b) if abs(cd(a, b)) <= abs(ccd(a, b)) else ccd(a, b)


def cd(a, b):
    a = al.index(a)
    b = al.index(b)
    return (b - a + 26) % 26


def ccd(a, b):
    a = al.index(a)
    b = al.index(b)
    return -1 * ((a - b + 26) % 26)


t = int(input())
s = [str(input()) for i in range(t)]
r = []

for i in range(t):
    r.append([])
    s[i] = "a" + s[i]
    for j in range(1, len(s[i])):
        r[i].append(sd(s[i][j - 1], s[i][j]))

    print(" ".join(str(j) for j in r[i]))
