from sys import stdin, setrecursionlimit


def main():
    s, t = map(str, stdin.readline().split())
    a, b = map(int, stdin.readline().split())
    u = stdin.readline()[:-1]

    if s == u:
        a -= 1
    else:
        b -= 1

    print(a, b)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main() from sys import stdin, setrecursionlimit def main():
    s, t = map(str, stdin.readline().split())
    a, b = map(int, stdin.readline().split())
    u = stdin.readline()[:-1]

    if s == u:
        a -= 1
    else:
        b -= 1

    print(a, b) main s, t = map(str, stdin.readline().split()) s map(str, stdin.readline().split()) map str stdin.readline().split() stdin.readline().split stdin.readline() stdin.readline stdin readline split t a, b = map(int, stdin.readline().split()) a map(int, stdin.readline().split()) map int stdin.readline().split() stdin.readline().split stdin.readline() stdin.readline stdin readline split b u = stdin.readline()[:-1] u stdin.readline()[:-1] stdin.readline() stdin.readline stdin readline :-1 -1 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 if __name__ == "__main__":
    setrecursionlimit(10000)
    main() __name__ == "__main__" __name__ "__main__" setrecursionlimit(10000) setrecursionlimit 10000 main() main def main():
    s, t = map(str, stdin.readline().split())
    a, b = map(int, stdin.readline().split())
    u = stdin.readline()[:-1]

    if s == u:
        a -= 1
    else:
        b -= 1

    print(a, b) def main():
    s, t = map(str, stdin.readline().split())
    a, b = map(int, stdin.readline().split())
    u = stdin.readline()[:-1]

    if s == u:
        a -= 1
    else:
        b -= 1

    print(a, b) main
from sys import stdin, setrecursionlimit


def main():
    s, t = map(str, stdin.readline().split())
    a, b = map(int, stdin.readline().split())
    u = stdin.readline()[:-1]

    if s == u:
        a -= 1
    else:
        b -= 1

    print(a, b)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()