#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    s, t = input().split()
    a, b = MI()
    u = input()

    if s == u:
        a -= 1
    else:
        b -= 1
    print(a, b)


main() import collections as cl collections import sys sys def II():
    return int(sys.stdin.readline()) II return int(sys.stdin.readline()) int(sys.stdin.readline()) int sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline def MI():
    return map(int, sys.stdin.readline().split()) MI return map(int, sys.stdin.readline().split()) map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split def LI():
    return list(map(int, sys.stdin.readline().split())) LI return list(map(int, sys.stdin.readline().split())) list(map(int, sys.stdin.readline().split())) list map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split def main():
    s, t = input().split()
    a, b = MI()
    u = input()

    if s == u:
        a -= 1
    else:
        b -= 1
    print(a, b) main s, t = input().split() s input().split() ().split () input split t a, b = MI() a MI() MI b u = input() u input() input if s == u:
        a -= 1
    else:
        b -= 1
     s == u s u a -= 1 a 1 b -= 1 b 1 print(a, b) print a b main() main def main():
    s, t = input().split()
    a, b = MI()
    u = input()

    if s == u:
        a -= 1
    else:
        b -= 1
    print(a, b) def main():
    s, t = input().split()
    a, b = MI()
    u = input()

    if s == u:
        a -= 1
    else:
        b -= 1
    print(a, b) main def MI():
    return map(int, sys.stdin.readline().split()) def MI():
    return map(int, sys.stdin.readline().split()) MI def II():
    return int(sys.stdin.readline()) def II():
    return int(sys.stdin.readline()) II def LI():
    return list(map(int, sys.stdin.readline().split())) def LI():
    return list(map(int, sys.stdin.readline().split())) LI
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    s, t = input().split()
    a, b = MI()
    u = input()

    if s == u:
        a -= 1
    else:
        b -= 1
    print(a, b)


main()
