def solve():
  S, T = input().split()
  ans = list(map(int, input().split()))
  U = input()
  if U==S:
    ans[0] -= 1
  else:
    ans[1] -= 1
  return ans
print(*solve()) def solve():
  S, T = input().split()
  ans = list(map(int, input().split()))
  U = input()
  if U==S:
    ans[0] -= 1
  else:
    ans[1] -= 1
  return ans solve S, T = input().split() S input().split() ().split () input split T ans = list(map(int, input().split())) ans list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split U = input() U input() input if U==S:
    ans[0] -= 1
  else:
    ans[1] -= 1
   U==S U S ans[0] -= 1 ans[0] ans 0 1 ans[1] -= 1 ans[1] ans 1 1 return ans ans print(*solve()) print *solve() solve() solve def solve():
  S, T = input().split()
  ans = list(map(int, input().split()))
  U = input()
  if U==S:
    ans[0] -= 1
  else:
    ans[1] -= 1
  return ans def solve():
  S, T = input().split()
  ans = list(map(int, input().split()))
  U = input()
  if U==S:
    ans[0] -= 1
  else:
    ans[1] -= 1
  return ans solve
def solve():
  S, T = input().split()
  ans = list(map(int, input().split()))
  U = input()
  if U==S:
    ans[0] -= 1
  else:
    ans[1] -= 1
  return ans
print(*solve())