Problem:
 Score : 100 points    Problem Statement  We have A balls with the string S written on each of them and B balls with the string T written on each of them. From these balls, Takahashi chooses one with the string U written on it and throws it away. Find the number of balls with the string S and balls with the string T that we have now.      Constraints   S , T , and U are strings consisting of lowercase English letters.  The lengths of S and T are each between 1 and 10 (inclusive).  S \not= T  S=U or T=U .  1 \leq A,B \leq 10  A and B are integers.         Input  Input is given from Standard Input in the following format:  S  T  A  B  U       Output  Print the answer, with space in between.        Sample Input 1 red blue
3 4
red      Sample Output 1 2 4  Takahashi chose a ball with red written on it and threw it away.
Now we have two balls with the string S and four balls with the string T .       Sample Input 2 red blue
5 5
blue      Sample Output 2 5 4  Takahashi chose a ball with blue written on it and threw it away.
Now we have five balls with the string S and four balls with the string T .

Solution (Python):

import re
import math
import itertools
from copy import deepcopy
import fractions
import random
from heapq import heappop,heappush
import time
import sys
readline = sys.stdin.readline

alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s

s,t=map(str,input().split())
a,b=map(int,input().split())
u=input()

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

Solution (Python):
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res

S,T=input().split()
i,j=LI()
term = input()
if term == S:
    i -= 1
if term == T:
    j -= 1

print(i,j)

Solution (Python):
s,t = map(str,input().split())

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

u = input()

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

Solution (Python):
s,t = input().split()
a,b = map(int, input().split())
u = input()
if  s==u: a-=1
if  t==u: b-=1
print(str(a)+' '+str(b))

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input() 

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

print(a, b)

Solution (Python):
S, T = input().strip().split()
A, B = map(int, input().split())
U = input().strip()

if S == U:
    A -= 1
else:
    B -= 1

print(A, B)

Solution (Python):
S,T = input().split()
A,B = map(int,input().split())
U = input()
if S == U:
    print(A-1,B)
else:
    print(A,B-1)

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

Solution (Python):
s,t=map(str,input().split())
a,b=map(int,input().split())
u=input()

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

Solution (Python):

import sys


def solve(S: str, T: str, A: int, B: int, U: str):
    if S==U:
        print(A-1, B)
    else:
        print(A, B-1)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  
    T = next(tokens)  
    A = int(next(tokens))  
    B = int(next(tokens))  
    U = next(tokens)  
    solve(S, T, A, B, U)

if __name__ == '__main__':
    main()

Solution (Python):
s, u = input().split()
sc, uc = map(int,input().split())
u = input()

if u == s:
  sc -= 1
else:
  uc -= 1

print(sc, uc)

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

if S == U:
    print(A-1, B)
else:
    print(A, B-1)

Solution (Python):
S,T = input().split()
A,B = input().split()
U = input()

if U == S:
  print(int(A)-1, int(B))
else:
  print(int(A), int(B)-1)

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

if S == U:
    print(A - 1, B)
else:
    print(A, B - 1)

Solution (Python):
S,T = [s for s in input().split()]
A,B = [int(s) for s in input().split()]
U = input()
if S == U:
    A-=1
else:
    B-=1
print("%d %d" % (A,B))

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

if U == S:
    A -= 1
else:
    B -= 1

print(A, B)

Solution (Python):
s,t = map(str,input().split())
a,b = map(int,input().split())
u = str(input())

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

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

Solution (Python):
s, t = map(str, input().split())
a, b = map(int, input().split())
u = input()

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

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()
if u == s:
    a -= 1
elif u == t:
    b -= 1
print(a, b)

Solution (Python):
s,t=map(str,input().split())
a,b=map(int,input().split())
u=input()
if u==s:
  a-=1
elif u==t:
  b-=1
print(a,b)

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()

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

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

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

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

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

if U == S:
    A -= 1
elif U == T:
    B -= 1

print(A, B)

Solution (Python):



from fractions import gcd 
from functools import reduce
import sys
sys.setrecursionlimit(200000000)
from inspect import currentframe




def printargs2err(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' : '+repr(arg) for arg in args),file=sys.stderr)
def debug(x):
    print(x,file=sys.stderr)
def printglobals():
    for (symbol, value) in globals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
def printlocals():
    for (symbol, value) in locals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)

def pin(type=int):
    return map(type,input().split())

def worstdata():
    a=0
    return a

def comp(x,y):
    dp=[0,max(act[0])]*(N+1) 
    
    return 0


S,T=pin(str)
A,B=pin()
U=input()
if U==S:
    A-=1
else:
    B-=1
print(A,B)

Solution (Python):
s,t=map(str,input().split())
a,b=map(int,input().split())
u=input()

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

Solution (Python):
r,b = input().split()
a,b = map(int,input().split())
x = input()
if r == x:
    print(a-1,b)
else:
    print(a,b-1)

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()

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

Solution (Python):
S, T = input().split()
a, b = map(int, input().split())
u = input()
if S == u:
    print(a - 1, b)
else:
    print(a, b - 1)

Solution (Python):
s,t = map(str, input().split())
a,b = map(int, input().split())
u = input()

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

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

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()
if u == s:
    a -= 1
else:
    b -= 1
print("{} {}".format(a,b))

Solution (Python):

S, T = input().split()
A, B = map(int, input().split())
U = input()
if U == S:
    A -= 1
else:
    B -= 1
print(A, B)

Solution (Python):
from sys import stdin
s,t = [x for x in stdin.readline().rstrip().split()]
a,b = map(int,stdin.readline().rstrip().split())
k = stdin.readline().rstrip()
if k == s:
    print(a-1,b)
elif k == t:
    print(a,b-1)
else:
    print(a,b)

Solution (Python):
s,t=map(str,input().split())
a,b=map(int,input().split())
u=input()

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

Solution (Python):
s,t = map(str,input().split())
a,b = map(int,input().split())
u=input()

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

print(a,b)

Solution (Python):
S,T=map(str, input().split())
A,B=map(int, input().split())
U = str(input())

if S == U:
    print(A-1,B)
else:
    print(A,B-1)

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

if U == S:
    print(A-1, B)
else:
    print(A, B-1)

Solution (Python):
s,t = map(str, input().split())
a, b = map(int, input().split())
u = input()

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

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

if U == S:
    A -= 1
else:
    B -= 1

print(A, B)

Solution (Python):

import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(S: str, T: str, A: int, B: int, U: str):
    if U == S:
        print(A-1, B)
    else:
        print(A, B-1)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  
    T = next(tokens)  
    A = int(next(tokens))  
    B = int(next(tokens))  
    U = next(tokens)  
    solve(S, T, A, B, U)

if __name__ == '__main__':
    main()

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

Solution (Python):

MOD = 10 ** 9 + 7
INFI = 10**10

import math

import itertools



import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default






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()

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

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())

u = input()


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

Solution (Python):
s,t=input().split()
a,b=map(int,input().split())
u=input()
if u==s:
    print(str(a-1)+" "+str(b))
else:
    print(str(a)+" "+str(b-1))

Solution (Python):
S, T = input().split(' ')
A, B = map(int, input().split())
U = input()
if S == U:
    print(A-1, B)
else:
    print(A, B-1)

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

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

if U == S:
    print(A - 1, B)
else:
    print(A, B - 1)

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

Solution (Python):
import sys
s, t  = [i for i in sys.stdin.readline().strip().split()]
a, b = [int(i) for i in sys.stdin.readline().split()]
u = input()
if u == s:
    a -= 1
if u == t:
    b -= 1
print(a, b)

Solution (Python):
s, t = input().split()
sint, tint = map(int, input().split())
temp = input()
if temp == s:
    sint-=1
else:
    tint-=1
print(sint, tint)

Solution (Python):
s,t = input().split()
a,b = map(int,input().split())
u = input()
if u == s:
  a -= 1
else:
  b -= 1
print("{} {}".format(a, b))

Solution (Python):
a, b = map(str, input().split())
red, blue = map(int, input().split())
s = input()

if a == s:
    print(red-1, blue)
else:
    print(red, blue-1)

Solution (Python):
s, t = map(str, input().split())
a, b = map(int, input().split())
u = str(input())

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

Solution (Python):

import sys
input = sys.stdin.readline
INF = 10**9

s, t = input().split()
n, m = map(int, input().split())
u = input().rstrip()

if u == s:
    n -= 1
else:
    m -= 1
print(n, m)

Solution (Python):
S,T=map(str,input().split())
A,B=map(int,input().split())
U=input()

if U==S:
   print(A-1,B)
else:
   print(A,B-1)

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()

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

Solution (Python):
S,T=input().split()
A,B=map(int,input().split())
U=input()
print(*(A-1,B) if U==S else (A,B-1))

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()

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

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

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()

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

Solution (Python):
s, t = [i for i in input().split()]
a, b = [int(i) for i in input().split()]
u = input()

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

Solution (Python):
S,T = input().split()
A,B = map(int,input().split())
U = input()
if U==S:
    A -= 1
else:
    B -= 1
print(A,B)

Solution (Python):
s, t = input().split()
a, b = map(int,input().split())
u = input()
d = dict()
d[s] = a
d[t] = b
d[u] -= 1
print("{0} {1}".format(d[s], d[t]))

Solution (Python):
S, T=(i for i in input().split())
N, M=(int(i) for i in input().split())
U=input()
if U==S:
    N-=1
else:
    M-=1
print(N,M)

Solution (Python):
S,T = input().split()
A,B = map(int,input().split())
U = input()

if U == S:
    A -=1
elif U == T:
    B -= 1
print(A,B)

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()
if u == s:
  print(*[a-1, b])
else:
  print(*[a, b-1])

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    s, T = LS()
    A, B = LI()
    U = S()
    if U == s:
        print(A-1, B)
    else:
        print(A, B-1)

main()

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

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

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

Solution (Python):
S,T = map(str,input().split())
A,B = map(int,input().split())
U = input()

if S == U:
    A -= 1
elif T == U:
    B -= 1

print(A,B)

Solution (Python):
import sys
input = sys.stdin.readline
S, T  = [x for x in input().strip().split()]
A, B  = [int(x) for x in input().strip().split()]
U = input().strip()
if S == U:
    print(A-1, B)
else:
    print(A, B-1)

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

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

Solution (Python):
def main():
    S, T = input().split()
    A, B = map(int, input().split())
    U = input()
    if S == U:
        print(A-1, B)
    else:
        print(A, B-1)


if __name__ == "__main__":
    main()

Solution (Python):
S, T = input().split()
A, B = [int(i) for i in input().split()]
U = input()

if U == S:
    A -= 1
else:
    B -= 1

print(A, B)

Solution (Python):
def main():
    s, t = [x for x in input().split()]
    a, b = [int(x) for x in input().split()]
    u = input()
    print(a-(s==u), b-(t==u))


if __name__ == '__main__':
    main()

Solution (Python):
s,t = list(input().split())
A,B = map(int,input().split())
u = input()
if u == s:
    print(A-1,B)
else:
    print(A,B-1)

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()

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

Solution (Python):

S, T = map(str, input().split())
A,B =  map(int, input().split())
U = input()

if U == S:
    A -= 1
else:
    B -= 1

print(A,B)

Solution (Python):
import sys
input = sys.stdin.readline
S, T = input().split()
A, B = map(int, input().split())
U = input()[: -1]
print(A - (S == U), B - (T == U))

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

if U == S:
    A -= 1
else:
    B -= 1

print(*[A, B])

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()

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

Solution (Python):
s,t=input().split()
a,b=map(int,input().split())
u=input()

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

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

Solution (Python):
S, T = raw_input().split()
A, B = map(int, raw_input().split())
U = raw_input()

if U == S:
    A = A - 1
else:
    B = B -1

print A,B

Solution (Python):
a,b=input().split()
n,m=map(int,input().split())
s=input()

if a == s:
  print(n-1,m)
else:
  print(n,m-1)

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()


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

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

Solution (Python):
s, t = input().split()

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

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

Solution (Python):
s,t = map(str, input().split())
a,b = map(int, input().split())
u=input()

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

print(a,b)

Solution (Python):
S, T = map(str, input().split())
A, B = map(int, input().split())
U = str(input())

if S == U:
    print (A - 1, B)
else:
    print (A, B - 1)

Solution (Python):



import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

S, T = input().split()
A, B = map(int, input().split())
U = input()
if U == S:
    print(A - 1, B)
else:
    print(A, B - 1)

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

if U == S:
    print(A-1, B)
else:
    print(A, B-1)

Solution (Python):
S, T = input().split()
A, B = map(int,input().split())
U = input()

if S == U:
    print(A-1,B)
else:
    print(A,B-1)

Solution (Python):
s,t = input().split()
a,b = map(int,input().split())
u = input()

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

Solution (Python):
S,T=input().split()
A,B=map(int,input().split())
U=input()
if S==U:
  print(A-1,B)
else:
  print(A,B-1)

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()
if S == U:
    print(A-1, B)
else:
    print(A, B-1)

Solution (Python):
S,T=input().split()
A,B=map(int,input().split())
U=input()
if S==U:
    print(A-1,B)
else:
    print(A,B-1)

Solution (Python):
S,T = map(str,input().split())
A,B = map(int,input().split())
U = input()
if U == S:
    print(A-1,B)
else:
    print(A,B-1)

Solution (Python):
Ss, Ts = input().split()
A, B = map(int, input().split())
Us = input()

if Us == Ss:
    A -= 1
if Us == Ts:
    B -= 1

print(A, B)

Solution (Python):
S,T=map(str, input().split())
A,B=map(int, input().split())
U=str(input())
if S==U:
  A-=1
else:
  B-=1

print(A,B)

Solution (Python):
s, t = map(str, input().split())
a, b = map(int, input().split())
u = input()

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

Solution (Python):
s,t=map(str,input().split())
n,m=map(int,input().split())
u=input()
if s==u:
  print(n-1,m)
else:
  print(n,m-1)

Solution (Python):
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()

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()
if S == U:
  print(A-1, B)
else:
  print(A, B-1)

Solution (Python):
S,T = input().split()
A,B = map(int,input().split())
U = input()

if S == U:
    print(A-1,B)
else:
    print(A,B-1)

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

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()

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

Solution (Python):
[s,t] = [i for i in input().split()]
[a,b] = [int(i) for i in input().split()]
u = input()
if s == u:
    print(a-1,b)
else:
    print(a,b-1)

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

Solution (Python):

from collections import defaultdict

con = 10 ** 9 + 7

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


def main():
	S, T = list(input().split())
	A, B = getlist()
	U = input()
	if S == U:
		A -= 1
	else:
		B -= 1
	print(A, B)
	


if __name__ == '__main__':
	main()

Solution (Python):
s,t=input().split()
a,b=[int(j) for j in input().split()]
u=input()
if s==u:
    print(a-1,b)
else:
    print(a,b-1)

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

if U == S:
    A -= 1
else:
    B -= 1

print(A, B)

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

if U == S:
  print(A-1, B)
else:
  print(A, B-1)

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)


S, T = input().split()
A, B = map(int, input().split())
U = input()

if S == U:
    A -= 1
else:
    B -= 1

print(A, B)

Solution (Python):

s, t = map(str,input().split())
a,b = map(int,input().split())
u = str(input())

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

Solution (Python):








mod = int(1e9+7)

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

if __name__=='__main__':
    main()

Solution (Python):
S,T = map(str,input().split())
A,B = map(int,input().split())
U = input()
print(A-1,B) if S == U else print(A,B-1)

Solution (Python):
s,t=input().split()
a,b=map(int,input().split())
u=input()

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

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

if U == S:
    A -= 1
else:
    B -= 1
print(A,B)

Solution (Python):
s,t = input().split()
a,b = map(int,input().split())
u = input()
print(a-(s==u),b-(t==u))

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()
print(A - 1 if U == S else A, B if U == S else B - 1)

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()
if U==S:
  A-=1
else:
  B-=1
print(A, B)

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

Solution (Python):
S, T = map(str, input().split())
A, B = map(int, input().split())
M = input()
if S == M:
  print(A-1, B)
else:
  print(A, B - 1)

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

if S == U:
    A -= 1
else:
    B -= 1
    
print(A, B)

Solution (Python):
def main():
    S, T = input().split()
    A, B = map(int, input().split())
    U = input()
    if S == U:
        A -= 1
    else:
        B -= 1
    print(A,B)


if __name__ == "__main__":
    main()

Solution (Python):

S, T = map(str, input().split())
A, B = map(int, input().split())
U = input()
if U == S:
    print(A - 1, B)
else:
    print(A, B - 1)

Solution (Python):
def main():
    S, T = (i for i in input().split())
    A, B = (int(i) for i in input().split())
    U = input()
    if S == U:
        A -= 1
    else:
        B -= 1
    print(A, B)


if __name__ == '__main__':
    main()

Solution (Python):
s,t = input().split()
a,b = map(int, input().split())
u = input()

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

Solution (Python):
S,T=input().split(" ")
A,B=[int(i) for i in input().split(" ")]
U=input()

if S==U:
    print(A-1,B)
else:
    print(A,B-1)

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()
if U == S:
    print(A-1, B)
else:
    print(A, B-1)

Solution (Python):
s,t = input().split()
a,b = map(int,input().split())
u = input()

if (s==u):
    a = a-1
if (t == u):
    b = b-1


print(a,b)

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()
print(A,B-1) if(U == T) else print(A-1, B)

Solution (Python):
S, T  = map(str,  input().split())
a, b= map(int, input().split())
U = str(input())

if U  == S:
  print(a-1,  b)
else:
  print(a,  b-1)

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()
if U == S:
    print(A-1, B)
else:
    print(A, B-1)

Solution (Python):
S,T=map(str,input().split())
A,B=map(int,input().split())
U=input()
if S==U:
    A-=1
else:
    B-=1
print(A,B)

Solution (Python):
s,t=input().split()
a,b=map(int,input().split())
u=input()
if s==u:
    a-=1
else:
    b-=1
print(str(a)+" "+str(b))

Solution (Python):
S,T = input().split()
A,B = map(int,input().split())
U = input()
if U==S:
    print(A-1,B)
else:
    print(A,B-1)

Solution (Python):
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

s,t = ns().split()
a,b = nm()
u = ns()
if u == s:
    a -= 1
else:
    b -= 1
print(a,b)

Solution (Python):
S, T = input().split()
A, B = map(int, input().split())
U = input()

if U == S:
    print(A-1, B)
else:
    print(A, B-1)

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

Solution (Python):
s, t = input().split()
a, b = map(int, input().split())
u = input()
if s == u:
    a -= 1
else:
    b -= 1

print(a, b)

Solution (Python):
S,T = map(str, input().split())
A,B = map(int, input().split())
U = input()

if U == S:
    print(A-1, B)
else:
    print(A, B-1)

Solution (Python):
S,T = input().split()
A,B = map(int,input().split())
U = input()

if S==U:
    print(A-1,B)
else:
    print(A,B-1)

Solution (Python):
S,T = input().split()
A,B = map(int,input().split())
U = input()
if S==U:
    A -= 1
else:
    B -= 1
print(A,B)

Solution (Python):
a,b = input().split()
aa,bb = map(int,input().split())
u = input()
if u==a:
    aa -= 1
else:
    bb -= 1
print(aa,bb)

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

s,t = input().split()
a,b = LI()
u = input()
if s == u:
    a -= 1
elif t == u:
    b -= 1
print(a,b)

Solution (Python):
import math,itertools,fractions,heapq,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  s,t=LS()
  a,b=LI()

  u=S()

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

main()

Solution (Python):
S,T = [zz for zz in input().split()]
A,B = [int(zz) for zz in input().split()]
U = input()

if U == S:
    A -= 1
elif U == T:
    B -= 1

print(A,B)

Solution (Python):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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