(s, t), (n, m), q = input().split(), map(int, input().split()), input()
print(f'{n} {m - 1}' if q == t else f'{n - 1} {m}') (s, t), (n, m), q = input().split(), map(int, input().split()), input() (s, t) s t input().split() ().split () input split (n, m) n m map(int, input().split()) map int input().split() ().split () input split q input() input print(f'{n} {m - 1}' if q == t else f'{n - 1} {m}') print f'{n} {m - 1}' if q == t else f'{n - 1} {m}' q == t q t f'{n} {m - 1}' f'{n - 1} {m}' q = input().split(), map(int, input().split()), input() input() q
(s, t), (n, m), q = input().split(), map(int, input().split()), input()
print(f'{n} {m - 1}' if q == t else f'{n - 1} {m}')