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

mydict = {S:A, T:B}

mydict[U] -= 1
print ( str( mydict[S] ) + " " +str( mydict[T] )  )
 S , T  = input().split() S 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 mydict = {S:A, T:B} mydict {S:A, T:B} S S A T T B mydict[U] -= 1 mydict[U] mydict U 1 print ( str( mydict[S] ) + " " +str( mydict[T] )  ) print str( mydict[S] ) + " " +str( mydict[T] ) str( mydict[S] ) + " " str( mydict[S] ) str mydict[S] mydict S " " str( mydict[T] ) str mydict[T] mydict T S , T  = input().split() input().split() S U = input() input() U A , B =map(int,input().split()) map(int,input().split()) A mydict = {S:A, T:B} {S:A, T:B} mydict B =map(int,input().split()) map(int,input().split()) B T  = input().split() input().split() T
S , T  = input().split()
A , B =map(int,input().split())
U = input()

mydict = {S:A, T:B}

mydict[U] -= 1
print ( str( mydict[S] ) + " " +str( mydict[T] )  )

