s,t=(x for x in input().split())
a,b=(int(x) for x in input().split())
u=input()
if(s==u):
    a-=1
else:
    b-=1
print(a,b) x for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() x s,t=(x for x in input().split()) s (x for x in 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):
    a-=1
else:
    b-=1 s==u s u a-=1 a 1 b-=1 b 1 print(a,b) print a b a-=1 1 a b-=1 1 b t=(x for x in input().split()) (x for x in input().split()) t b=(int(x) for x in input().split()) (int(x) for x in input().split()) b a,b=(int(x) for x in input().split()) (int(x) for x in input().split()) a u=input() input() u s,t=(x for x in input().split()) (x for x in input().split()) s
s,t=(x for x in input().split())
a,b=(int(x) for x in input().split())
u=input()
if(s==u):
    a-=1
else:
    b-=1
print(a,b)