import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
void main()
{
    auto st = aryread!string();
    writeln(st);
    long a, b;
    scan(a, b);
    auto u = sread();
    writeln(u);
    if (u == s)
    {
        writeln(a - 1, ' ', b);
    }
    else if (u == t)
    {
        writeln(a, ' ', b - 1);
    }

}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}
