#!/usr/bin/env python3
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    S, T = (s.decode() for s in readline().rstrip().split())
    A, B = map(int, readline().split())
    U = readline().rstrip().decode()
    if S == U:
        A -= 1
    else:
        B -= 1
    print(A, B)


if __name__ == '__main__':
    main() import sys sys read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline readlines = sys.stdin.buffer.readlines readlines sys.stdin.buffer.readlines sys.stdin.buffer sys.stdin sys stdin buffer readlines def main():
    S, T = (s.decode() for s in readline().rstrip().split())
    A, B = map(int, readline().split())
    U = readline().rstrip().decode()
    if S == U:
        A -= 1
    else:
        B -= 1
    print(A, B) main s.decode() for s in readline().rstrip().split() for s in readline().rstrip().split() s readline().rstrip().split() ().rstrip().split ().rstrip() ().rstrip () readline rstrip split for s in readline().rstrip().split() s.decode() s.decode s decode S, T = (s.decode() for s in readline().rstrip().split()) S (s.decode() for s in readline().rstrip().split()) T A, B = map(int, readline().split()) A map(int, readline().split()) map int readline().split() ().split () readline split B U = readline().rstrip().decode() U readline().rstrip().decode() ().rstrip().decode ().rstrip() ().rstrip () readline rstrip decode 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__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    S, T = (s.decode() for s in readline().rstrip().split())
    A, B = map(int, readline().split())
    U = readline().rstrip().decode()
    if S == U:
        A -= 1
    else:
        B -= 1
    print(A, B) def main():
    S, T = (s.decode() for s in readline().rstrip().split())
    A, B = map(int, readline().split())
    U = readline().rstrip().decode()
    if S == U:
        A -= 1
    else:
        B -= 1
    print(A, B) main readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline readlines = sys.stdin.buffer.readlines sys.stdin.buffer.readlines readlines read = sys.stdin.buffer.read sys.stdin.buffer.read read
#!/usr/bin/env python3
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    S, T = (s.decode() for s in readline().rstrip().split())
    A, B = map(int, readline().split())
    U = readline().rstrip().decode()
    if S == U:
        A -= 1
    else:
        B -= 1
    print(A, B)


if __name__ == '__main__':
    main()
