S, T = [s for s in input().split(' ')]
A, B = [int(s) for s in input().split(' ')]
U = input()
d = {S:A,T:B}

d[U] = d[U] - 1
print('%d %d' % (d[S], d[T])) s for s in input().split(' ') for s in input().split(' ') s input().split(' ') ().split () input split ' ' for s in input().split(' ') s S, T = [s for s in input().split(' ')] S [s for s in input().split(' ')] T int(s) for s in input().split(' ') for s in input().split(' ') s input().split(' ') ().split () input split ' ' for s in input().split(' ') int(s) int s A, B = [int(s) for s in input().split(' ')] A [int(s) for s in input().split(' ')] B U = input() U input() input d = {S:A,T:B} d {S:A,T:B} S S A T T B d[U] = d[U] - 1 d[U] d U d[U] - 1 d[U] d U 1 print('%d %d' % (d[S], d[T])) print '%d %d' % (d[S], d[T]) '%d %d' (d[S], d[T]) d[S] d S d[T] d T S, T = [s for s in input().split(' ')] [s for s in input().split(' ')] S d = {S:A,T:B} {S:A,T:B} d A, B = [int(s) for s in input().split(' ')] [int(s) for s in input().split(' ')] A U = input() input() U T = [s for s in input().split(' ')] [s for s in input().split(' ')] T B = [int(s) for s in input().split(' ')] [int(s) for s in input().split(' ')] B
S, T = [s for s in input().split(' ')]
A, B = [int(s) for s in input().split(' ')]
U = input()
d = {S:A,T:B}

d[U] = d[U] - 1
print('%d %d' % (d[S], d[T]))
