import os, sys, re, math

(S, T) = [n for n in input().split()]
(A, B) = [int(n) for n in input().split()]
U = input()

if U == S:
    A -= 1
else:
    B -= 1

print('%s %s' % (A, B)) import os, sys, re, math os sys re math n for n in input().split() for n in input().split() n input().split() ().split () input split for n in input().split() n (S, T) = [n for n in input().split()] (S, T) S T [n for n in input().split()] int(n) for n in input().split() for n in input().split() n input().split() ().split () input split for n in input().split() int(n) int n (A, B) = [int(n) for n in input().split()] (A, B) A B [int(n) for n in input().split()] U = input() U input() input if U == S:
    A -= 1
else:
    B -= 1 U == S U S A -= 1 A 1 B -= 1 B 1 print('%s %s' % (A, B)) print '%s %s' % (A, B) '%s %s' (A, B) A B B -= 1 1 B A -= 1 1 A U = input() input() U
import os, sys, re, math

(S, T) = [n for n in input().split()]
(A, B) = [int(n) for n in input().split()]
U = input()

if U == S:
    A -= 1
else:
    B -= 1

print('%s %s' % (A, B))
