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

if __name__ == '__main__':
    main() def main():
    s, t = input().split()
    a, b = map(int, input().split())
    u = input()
    if u == s:
        a -= 1
    else:
        b -= 1
    print(a, b) main 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 u = input() u input() input if u == s:
        a -= 1
    else:
        b -= 1
     u == s u s 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 = input().split()
    a, b = map(int, input().split())
    u = input()
    if u == s:
        a -= 1
    else:
        b -= 1
    print(a, b) def main():
    s, t = input().split()
    a, b = map(int, input().split())
    u = input()
    if u == s:
        a -= 1
    else:
        b -= 1
    print(a, b) main
def main():
    s, t = input().split()
    a, b = map(int, input().split())
    u = input()
    if u == s:
        a -= 1
    else:
        b -= 1
    print(a, b)

if __name__ == '__main__':
    main()