s, t = (x for x in raw_input().split())
a, b = (int(x) for x in raw_input().split())
u = raw_input()
if s == u:
  a -= 1
else:
  b -= 1
print "{} {}".format(a, b) x for x in raw_input().split() for x in raw_input().split() x raw_input().split() ().split () raw_input split for x in raw_input().split() x s, t = (x for x in raw_input().split()) s (x for x in raw_input().split()) t int(x) for x in raw_input().split() for x in raw_input().split() x raw_input().split() ().split () raw_input split for x in raw_input().split() int(x) int x a, b = (int(x) for x in raw_input().split()) a (int(x) for x in raw_input().split()) b u = raw_input() u raw_input() raw_input if s == u:
  a -= 1
else:
  b -= 1 s == u s u a -= 1 a 1 b -= 1 b 1 print "{} {}".format(a, b) "{} {}".format "{} {}" format a b b -= 1 1 b a, b = (int(x) for x in raw_input().split()) (int(x) for x in raw_input().split()) a a -= 1 1 a s, t = (x for x in raw_input().split()) (x for x in raw_input().split()) s t = (x for x in raw_input().split()) (x for x in raw_input().split()) t b = (int(x) for x in raw_input().split()) (int(x) for x in raw_input().split()) b u = raw_input() raw_input() u
s, t = (x for x in raw_input().split())
a, b = (int(x) for x in raw_input().split())
u = raw_input()
if s == u:
  a -= 1
else:
  b -= 1
print "{} {}".format(a, b)