s,t=list(input().split())
a,b=list(map(int,input().split()))
u=input()
ball={s:a,t:b}  
ball[u] =max(0,ball[u]-1)

print(ball[s],ball[t]) s,t=list(input().split()) s list(input().split()) list input().split() ().split () input split t a,b=list(map(int,input().split())) a list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split b u=input() u input() input ball={s:a,t:b} ball {s:a,t:b} s s a t t b ball[u] =max(0,ball[u]-1) ball[u] ball u max(0,ball[u]-1) max 0 ball[u]-1 ball[u] ball u 1 print(ball[s],ball[t]) print ball[s] ball s ball[t] ball t b=list(map(int,input().split())) list(map(int,input().split())) b a,b=list(map(int,input().split())) list(map(int,input().split())) a t=list(input().split()) list(input().split()) t s,t=list(input().split()) list(input().split()) s u=input() input() u ball={s:a,t:b} {s:a,t:b} ball
s,t=list(input().split())
a,b=list(map(int,input().split()))
u=input()
ball={s:a,t:b}  
ball[u] =max(0,ball[u]-1)

print(ball[s],ball[t])