// Задача "Шахматная головоломка"
// XVIII командный чемпионат школьников Санкт-Петербурга по программированию
// Автор задачи: Виталий Аксенов
// Автор решения: Владимир Ульянцев, ulyantsev@rain.ifmo.ru

uses
    sysutils, Math;
type
    int = longint;

var
    ch : char;
    x, y : int;

function is_rock_beat_position(rx, ry, x, y : int) : boolean;
begin
    result := (rx = x) or (ry = y);
end;

function is_bishop_beat_position(bx, by, x, y : int) : boolean;
begin
    result := (bx - x = by - y) or (bx + by = x + y);
end;

procedure solve();
var
    rx, ry, bx, by : int;
begin
    for rx := 1 to 8 do begin
        for ry := 1 to 8 do begin
            for bx := 1 to 8 do begin
                for by := 1 to 8 do begin
                    if (is_bishop_beat_position(bx, by, x, y) and 
                        is_rock_beat_position(rx, ry, x, y) and
                        not is_rock_beat_position(rx, ry, bx, by) and
                        not is_bishop_beat_position(bx, by, rx, ry) and
                        not ((rx = x) and (ry = y)) and 
                        not ((x = bx) and (y = by))) then begin
                        
                        writeln(chr(ord('a') + ry - 1), rx);
                        writeln(chr(ord('a') + by - 1), bx);
                        exit;    
                    end;
                end;
            end;
        end;
    end;
end;

begin
    assign(input, 'chess.in');
    reset(input);
    assign(output, 'chess.out');
    rewrite(output);

    read(ch);
    y := ord(ch) - ord('a') + 1;
    read(x);

    assert((1 <= x) and (x <= 8) and (1 <= y) and (y <= 8));

    solve();

    close(input);
    close(output);
end.
