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.



Sample input:
red blue
3 4
red


Sample output:
2 4

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
a, b = map(str, input().split())
c, d = map(int, input().split())
e = str(input())
if e==a:
    print(c-1, d)
elif e==b:
    print(c, d-1)

Submission status: Accepted

Solution code:

if __name__ == '__main__':

	tmp0 = input().split()
	tmp1 = map(int,input().split())
	tmp2 = input()

	dic = {}

	for x,y in zip(tmp0,tmp1):
		dic[x] = y

	dic[tmp2] = dic[tmp2] - 1

	print(*dic.values())

Submission status: Accepted

Solution code:
lis=list(input().split())
num=list(map(int,input().split()))
num[lis.index(input())]-=1
print(str(num[0])+" "+str(num[1]))

Submission status: Accepted

Solution code:
s = list(input().split())
a, b = list(map(int, input().split()))
z = input()
k = a - 1
m = b - 1
if s[0] == z:
	print(k, end=' ')
	print(b)
elif s[1] == z:
	print(a, end=' ')
	print(m)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a = [i for i in input().split()]
nums = [int(i) for i in input().split()]
thr = input()
if(thr == a[0]):
	nums[0] -= 1
else:
	nums[1] -= 1
print(nums[0],nums[1])

Submission status: Accepted

Solution code:
def main():

    S, T = input().split()
    A, B = map(int, input().split())
    U = input()
    if U == S:
        return " ".join(map(str, [A-1, B]))
    else:
        return " ".join(map(str, [A, B-1]))

if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
# h, a = map(int, input().split())
from collections import OrderedDict
d = OrderedDict()
a = list(input().split())
b = list(map(int, input().split()))
for i in range(2):
	d[a[i]] = b[i]
d[input()] -= 1
print(*d.values())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S,T = (x for x in input().split())
A,B = map(int,input().split())
U = input()

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

print(A,B)

Submission status: Accepted

Solution code:
S, T = [x for x in input().split()]

A, B = [int(x) for x in input().split()]

U = input()

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

print('{} {}'.format(A, B))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

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

if u == s:
    a -= 1
elif u == t:
    b -= 1

print(a, b)

Submission status: Accepted

Solution code:
n, m = map(str, input().split())
a, b = map(int, input().split())
u = str(input())

if n==u:
  a=a-1
  
if m==u:
  b=b-1

print(a ,b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s,a,u=open(0)
i=u in s
print(int(a[:2])-1+i,int(a[2:])-i)

Submission status: Accepted

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


ans=[A,B]

if U==S:
    ans=[A-1,B]
else:
    ans=[A,B-1]


print(*ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S, T = readline().split()
    A, B = map(int, readline().split())
    U = readline().strip()

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

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(str, input().split())
N, M = map(int, input().split())
S = input()

if A == S:
  print(N-1,M)
elif B == S:
  print(N,M-1)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
[S,T]=list(map(str, input().split()))
[A,B]=list(map(int, input().split()))
U=str(input())
if U==S:
    print(A-1,B)
elif U==T:
    print(A,B-1)

Submission status: Accepted

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

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

print("{} {}".format(a, b))

Submission status: Accepted

Solution code:
import math
import collections

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
lst = input().split()
ab = list(map(int, input().split()))
ab[lst.index(input())] -= 1
print(str(ab[0]) + ' ' + str(ab[1]))

Submission status: Accepted

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


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

print(a, b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input().split()
a, b = map(int, input().split())
t = input()
if s[0] == t:
  print(str(a-1) + " " + str(b))
else:
  print(str(a) + " " + str(b-1))

Submission status: Accepted

Solution code:
S,T=input().split()
A,B=map(int,input().split())
U=input()
if(U==S):
  print("{}".format(A-1)+" {}".format(B))
else:
  print("{}".format(A)+" {}".format(B-1))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
s,t = input().split()
a,b = [int(a)for a in input().split()]
c = input()
if c==s:
  print(a-1,b)
elif c==t:
  print(a,b-1)

Submission status: Accepted

Solution code:
dic = {}
S, T = input().split()
A, B = map(int, input().split())
dic[S] = A
dic[T] = B
U = input()
dic[U] -= 1
print(dic[S], dic[T])

Submission status: Accepted

Solution code:
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)
else:
  print(a, b)

Submission status: Accepted

Solution code:
s = input().split()
t = list(map(int,input().split()))
d = {s[0]:t[0],s[1]:t[1]}
d[input()]-=1
print(d[s[0]], d[s[1]])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
(s,t,),(a,b,),(u,)=[t.split() for t in open(0)]
print(int(a)-(s==u),int(b)-(t==u))

Submission status: Accepted

Solution code:
x, t = input().split()
a, b = map(int, input().split())
u = input()
dic = {x:a, t:b}

for i in dic.keys():
  if i == u:
    dic[i] -= 1

print(dic[x], dic[t])

Submission status: Accepted

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

print(str(a)+' '+str(b))

Submission status: Accepted

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

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

Submission status: Accepted

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

if s==u:
    a-=1

if t==u:
    b-=1
print('%d %d' % (a, b))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

dic = {s:a, t:b}

dic[u] = dic[u] - 1

print(dic[s], dic[t])

Submission status: Accepted

Solution code:
red, blue = input().split()
red_num, blue_num = list(map(int, input().split()))
s = input()

if s == red:
    red_num -= 1
elif s == blue:
    blue_num -= 1

print(str(red_num) + ' ' + str(blue_num))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(a,b)

Submission status: Accepted

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

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

print(A, B)

Submission status: Accepted

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

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

print(a,b)

Submission status: Accepted

Solution code:
a,b=map(str,input().split())
c,d=map(int,input().split())
e=input()
if a==e:
    c=c-1
else:
    d=d-1
print(c,d)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

if S == U:
    A -= 1
    l = [A,B]
    print(' '.join(map(str,l)))
elif T == U:
    B -= 1
    l = [A, B]
    print(' '.join(map(str, l)))

Submission status: Accepted

Solution code:
a,b=map(str,input().split())
c,d=map(int,input().split())
k=input()
if k==a:
    c-=1
else:
    d-=1
print(c,d)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
x = dict()
s,t = input().split()
n,m = map(int, input().split())
x[s] = n
x[t] = m
p = input()
x[p] -= 1
print(x[s], x[t])

Submission status: Accepted

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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

Submission status: Accepted

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

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

print(A, B)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
mod = 1e9+7
def add(a, b):
    c = a + b
    if c >= mod:
        c -= mod
    return c

def main():
    A, B = [x for x in raw_input().split()]
    
    A_cnt, B_cnt = [int(x) for x in raw_input().split()]
    
    throw_away = raw_input()
    
    if throw_away == A:
        A_cnt -= 1
    else:
        B_cnt -= 1
    
    print(str(A_cnt) + " " + str(B_cnt))
    

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s, t = input("").split(" ")
a, b = [int(i) for i in input("").split(" ")]
u = input("")
if(s == u):
    a -= 1
elif(t == u):
    b -= 1
print(f"{a} {b}")

Submission status: Accepted

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

Submission status: Accepted

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

if(S==U):
    print(str(A-1)+' '+str(B))
else:
    print(str(A)+' '+str(B-1))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
s,t,a,b,u=open(0).read().split()
if s==u:
    print(int(a)-1,b)
elif t==u:
    print(a,int(b)-1)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S,T=input().split()
A,B=(int(a) for a in input().split())
U = input()
if S == U :
    print(A-1,B)
else : print(A,B-1)

Submission status: Accepted

Solution code:
a,b = map(str, input().split())
one,two = map(int, input().split())
dis = input()

if dis == a: print(one-1, two)
else: print(one, two-1)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

if U == S:
    A -= 1
elif U == T:
    B -= 1
print("{} {}".format(A, B))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
S,T,A,B,U = open(0).read().split()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
l1=input().split()
l2=list(map(int,input().split()))
l2[l1.index(input())]-=1
print(" ".join(str(x) for x in l2))

Submission status: Accepted

Solution code:
# 154 A

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

if u == s:
    a = a - 1
elif u == t:
    b = b - 1

print(a, end = " ")
print(b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

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

print(str(A) + ' ' + str(B))

Submission status: Accepted

Solution code:
z = [x for x in input().split()]
x = [int(x) for x in input().split()]
y = input()
if (y == z[0]):
      print(x[0]-1,x[1])
else:
      print(x[0], x[1]-1)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    #N = int(input())
    S,T=input().split()

    A,B = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    s=input()
    if s==S:
        print(max(0,A-1),B)
    else:
        print(A,max(B-1,0))





if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S,T = input().split()
A,B = (int(x) for x in input().split())
U   = input()
if S==U:
    print('{} {}'.format(A-1,B))
else:
    print('{} {}'.format(A,B-1))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
    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)

if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S, T = input().split()
A, B = map(int, input().split())
U = input()
if U == S:
  A -= 1
else:
  B -= 1
print('{0} {1}'.format(A, B))

Submission status: Accepted

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

cnt = {}
cnt[s], cnt[t] = map(int, input().split())
u = input()
cnt[u]-=1

print(cnt[s], cnt[t])

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
#A
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
S, M = map(str,input().split())
A, B = map(int,input().split())
U = str(input())
if U == S:
    print(A - 1, B)
elif U == M:
    print(A, B -1)

Submission status: Accepted

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

if S==U:
  a=1
  b=0
else:
  a=0
  b=1

print(A-a,B-b)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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


if U==S:
    print("{} {}".format(A-1,B))
else:
    print("{} {}".format(A,B-1))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

else:
  print(a,b-1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
w = list(input().split())
n = list(map(int, input().split()))
u = input()

if u == w[0]:
  print(n[0]-1,n[1])
else:
  print(n[0],n[1]-1)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

else :
	print(A-1,B)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def II(): return str(input())
def MI(): return map(int,input().split())
def MI2(): return map(str,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    S, T = MI2()
    A, B = MI()
    U = II()
    
    if U == S:
        A = A-1
    elif U == T:
        B = B-1
    
    print(A, B)

if __name__ == "__main__":
	main()

Submission status: Accepted

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

if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
l = list(input() for _ in range(3))
str1 , str2 = l[0].split()
num1 , num2 = map(int,l[1].split())
if l[2] == str1:
  num1 -= 1
  print(num1 , num2)
else:
  num2 -= 1
  print(num1 , num2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Vicfred
# https://atcoder.jp/contests/abc154/tasks/abc154_a
# simulation
s, t = input().split()
a, b = list(map(int, input().split()))
u = input()

balls = {}
balls[s] = a
balls[t] = b
balls[u] = balls[u] - 1

print(balls[s], balls[t])

Submission status: Accepted

Solution code:
print(' '.join((lambda x:[str((x[2]-1)) if x[4] == x[0] else str(x[2]),str((x[3]-1)) if x[4] == x[1] else str(x[3])])(input().split()+list(map(int,input().split()))+[input()])))

Submission status: Accepted

Solution code:
#<ABC154>
#<A>
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)

Submission status: Accepted

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

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