import itertools

import fractions

def main():

  s,t = list(map(str,input().split()))

  a,b = list(map(int,input().split()))

  u = eval(input())

  if s == u:

    a -=1

  else:

    b -=1

  print((a,b))

if __name__ == '__main__':

  main()
#from statistics import median

#import collections

#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]

#from itertools import combinations # (string,3) 3回

#from collections import deque

#import collections.defaultdict(list)

#import bisect

#

#    d = m - k[i] - k[j]

#    if kk[bisect.bisect_right(kk,d) - 1] == d:

#

#

#

# pythonで無理なときは、pypyでやると正解するかも！！

#

#



mod = 10**9 + 7



def readInts():

  return list(map(int,input().split()))

def main():

    s,t = input().split()

    a,b = readInts()

    u = eval(input())

    if u == s:

        a -=1

    else:

        b -=1

    print((a,b))

if __name__ == '__main__':

  main()

import itertools
import fractions


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


if __name__ == "__main__":
    main()

# from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
# from itertools import combinations # (string,3) 3回
# from collections import deque
# import collections.defaultdict(list)
# import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
mod = 10**9 + 7


def readInts():
    return list(map(int, input().split()))


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


if __name__ == "__main__":
    main()

-import itertools -import fractions +# from statistics import median +# import collections +# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] +# from itertools import combinations # (string,3) 3回 +# from collections import deque +# import collections.defaultdict(list) +# import bisect +# +#    d = m - k[i] - k[j] +#    if kk[bisect.bisect_right(kk,d) - 1] == d: +# +# +# +# pythonで無理なときは、pypyでやると正解するかも！！ +# +# +mod = 10**9 + 7 + + +def readInts(): +    return list(map(int, input().split())) -    s, t = list(map(str, input().split())) -    a, b = list(map(int, input().split())) +    s, t = input().split() +    a, b = readInts() -    if s == u: +    if u == s: