S, T = "red", "blue"
A, B = 3, 4
U = "red"

S, T = map(str, input().split())
A, B = map(int, input().split())
U = input()


def calculate(s, t, a, b, u):
    if u == s:
        print("{} {}".format((a - 1), b))
    else:
        print("{} {}".format(a, (b - 1)))


calculate(S, T, A, B, U) S, T = "red", "blue" S "red" T "blue" A, B = 3, 4 A 3 B 4 U = "red" U "red" S, T = map(str, input().split()) S map(str, input().split()) map str input().split() ().split () input split T A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B U = input() U input() input def calculate(s, t, a, b, u):
    if u == s:
        print("{} {}".format((a - 1), b))
    else:
        print("{} {}".format(a, (b - 1))) calculate if u == s:
        print("{} {}".format((a - 1), b))
    else:
        print("{} {}".format(a, (b - 1))) u == s u s print("{} {}".format((a - 1), b)) print "{} {}".format((a - 1), b) "{} {}".format "{} {}" format a - 1 a 1 b print("{} {}".format(a, (b - 1))) print "{} {}".format(a, (b - 1)) "{} {}".format "{} {}" format a b - 1 b 1 s s t t a a b b u u calculate(S, T, A, B, U) calculate S T A B U S, T = map(str, input().split()) map(str, input().split()) S A, B = 3, 4 3 A U = "red" "red" U U = input() input() U T = map(str, input().split()) map(str, input().split()) T T = "red", "blue" "blue" T B = map(int, input().split()) map(int, input().split()) B S, T = "red", "blue" "red" S A, B = map(int, input().split()) map(int, input().split()) A def calculate(s, t, a, b, u):
    if u == s:
        print("{} {}".format((a - 1), b))
    else:
        print("{} {}".format(a, (b - 1))) def calculate(s, t, a, b, u):
    if u == s:
        print("{} {}".format((a - 1), b))
    else:
        print("{} {}".format(a, (b - 1))) calculate B = 3, 4 4 B
S, T = "red", "blue"
A, B = 3, 4
U = "red"

S, T = map(str, input().split())
A, B = map(int, input().split())
U = input()


def calculate(s, t, a, b, u):
    if u == s:
        print("{} {}".format((a - 1), b))
    else:
        print("{} {}".format(a, (b - 1)))


calculate(S, T, A, B, U)
