import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    S, T = input().split()
    A, B = map(int, readline().split())
    U = input()

    if S == U:
        A -= 1
    if T == U:
        B -= 1
    print(A, B)


if __name__ == '__main__':
    main() import sys sys readline = sys.stdin.readline readline sys.stdin.readline sys.stdin sys stdin readline MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 INF = float('INF') INF float('INF') float 'INF' sys.setrecursionlimit(10 ** 5) sys.setrecursionlimit sys setrecursionlimit 10 ** 5 10 5 def main():
    S, T = input().split()
    A, B = map(int, readline().split())
    U = input()

    if S == U:
        A -= 1
    if T == U:
        B -= 1
    print(A, B) main S, T = input().split() S input().split() ().split () input split T A, B = map(int, readline().split()) A map(int, readline().split()) map int readline().split() ().split () readline split B U = input() U input() input if S == U:
        A -= 1
     S == U S U A -= 1 A 1 if T == U:
        B -= 1
     T == U T U B -= 1 B 1 print(A, B) print A B if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main readline = sys.stdin.readline sys.stdin.readline readline def main():
    S, T = input().split()
    A, B = map(int, readline().split())
    U = input()

    if S == U:
        A -= 1
    if T == U:
        B -= 1
    print(A, B) def main():
    S, T = input().split()
    A, B = map(int, readline().split())
    U = input()

    if S == U:
        A -= 1
    if T == U:
        B -= 1
    print(A, B) main INF = float('INF') float('INF') INF MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    S, T = input().split()
    A, B = map(int, readline().split())
    U = input()

    if S == U:
        A -= 1
    if T == U:
        B -= 1
    print(A, B)


if __name__ == '__main__':
    main()
