n = input()
row = int(n[1])
column = int(ord(n[0]))  - int(ord('a')) +1

steps = [(-2,1),(-1,-2)]

for step in steps:

print(row,column)
"""
xcoor = dict()
xcoor['a'] = 1
xcoor['b'] = 1
xcoor['c'] = 1
xcoor['d'] = 1
xcoor['e'] = 1
xcoor['f'] = 1
xcoor['g'] = 1
xcoor['h'] = 1
nx = xcoor[n[0]]
ny = int(n[1])
"""



