from operator import xor
from functools import reduce


def resolve():
    s, t = input().split()
    a, b = map(int, input().split())
    d = {s: a, t: b}
    u = input()
    d[u] -= 1
    print(d[s], d[t])

if __name__ == "__main__":
    resolve() from operator import xor from functools import reduce def resolve():
    s, t = input().split()
    a, b = map(int, input().split())
    d = {s: a, t: b}
    u = input()
    d[u] -= 1
    print(d[s], d[t]) resolve s, t = input().split() s input().split() ().split () input split t a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b d = {s: a, t: b} d {s: a, t: b} s s a t t b u = input() u input() input d[u] -= 1 d[u] d u 1 print(d[s], d[t]) print d[s] d s d[t] d t if __name__ == "__main__":
    resolve() __name__ == "__main__" __name__ "__main__" resolve() resolve def resolve():
    s, t = input().split()
    a, b = map(int, input().split())
    d = {s: a, t: b}
    u = input()
    d[u] -= 1
    print(d[s], d[t]) def resolve():
    s, t = input().split()
    a, b = map(int, input().split())
    d = {s: a, t: b}
    u = input()
    d[u] -= 1
    print(d[s], d[t]) resolve
from operator import xor
from functools import reduce


def resolve():
    s, t = input().split()
    a, b = map(int, input().split())
    d = {s: a, t: b}
    u = input()
    d[u] -= 1
    print(d[s], d[t])

if __name__ == "__main__":
    resolve()
