S, T = input().split()
A, B = (int(x) for x in input().split())
U = input()
if S == U or T == U:
  print(A - int(S==U), B - int(T==U))
   S, T = input().split() S input().split() ().split () input split T int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x A, B = (int(x) for x in input().split()) A (int(x) for x in input().split()) B U = input() U input() input if S == U or T == U:
  print(A - int(S==U), B - int(T==U))
   S == U or T == U S == U S U T == U T U print(A - int(S==U), B - int(T==U)) print A - int(S==U) A int(S==U) int S==U S U B - int(T==U) B int(T==U) int T==U T U T = input().split() input().split() T U = input() input() U A, B = (int(x) for x in input().split()) (int(x) for x in input().split()) A S, T = input().split() input().split() S B = (int(x) for x in input().split()) (int(x) for x in input().split()) B
S, T = input().split()
A, B = (int(x) for x in input().split())
U = input()
if S == U or T == U:
  print(A - int(S==U), B - int(T==U))
  
