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 = input().split()
A, B = map(int, input().split())
U  = input()
if S==U:
       A=A-1 
else:
        B=B-1 

print(A,'',B)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

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

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

Submission status: Accepted

Solution code:
s,t=input().split(' ')
a,b=map(int,input().split())
u=input()
if u==s:
    a=a-1
if 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()
C = 0
D = 0
if S == U:
    C = A - 1
    D = B
elif T == U:
    D = B - 1
    C = A
else:
    A = A

print(C, D)

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 = list(input().split())
A, B = list(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 = 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:
import sys

def main():
    k = input().replace('\n','').split()
    a = input().replace('\n','').split()
    u = input().replace('\n','')
    a[k.index(u)]=int(a[k.index(u)]) - 1
    print(str(a[0]) + ' ' + str(a[1]))
if __name__ == '__main__':
    input = sys.stdin.readline
    main()

Submission status: Accepted

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

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

print(A,end=" ")
print(B)

Submission status: Accepted

Solution code:
s, t = input().split(" ")
a, b = (int(x) for x in 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:
def solve():
    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)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(S: str, T: str, A: int, B: int, U: str):
    numA = A
    numB = B
    if U == S:
        numA -= 1
    else:  # U == T
        numB -= 1

    print(numA, numB)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    U = next(tokens)  # type: str
    solve(S, T, A, B, U)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# a = list(map(int, input().split()))
# N = int(input())

s, t = input().split()
a, b = list(map(int, input().split()))
dic = {}
dic[s] = a
dic[t] = b

string = input()
dic[string] -= 1
print(dic[s], dic[t])

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)
elif U==T:
    print(A,'',B-1)

Submission status: Accepted

Solution code:
input1 = input().split()
input2 = input().split()
input3 = input()

if input3 == input1[0]:
    input2[0] =  int(input2[0]) - 1
else:
    input2[1] =  int(input2[1]) - 1

print(str(input2[0]) + " " + str(input2[1]))

Submission status: Accepted

Solution code:
import math
import sys

m=10**9 + 7 
sys.setrecursionlimit(1000010)
(S,T) = input().split()
(A, B) = list(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()
A_B=input()
U=input()
list_S_T=[]
for i in range(len(S_T)):
    if S_T[i]==" ":
        S =S_T[0:i]
        T=S_T[i+1:len(S_T)]
for i in range(len(A_B)):
    if A_B[i]==" ":
        A = int(A_B[0:i])
        B = int(A_B[i+1:len(A_B)])
if S==U:
    A = A-1
elif T==U:
    B = 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 u==s:
  print("{} {}".format(a-1,b))
if u==t:
  print("{} {}".format(a,b-1))

Submission status: Accepted

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

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

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

Submission status: Accepted

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


if S == U:
	A -= 1
elif 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 = str(input())

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

print(A, B)

Submission status: Accepted

Solution code:
#cotest_temp

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,t=input().split()
# print(s,t)
ns,nt=map(int,input().split())
# print(ns,nt)
judge = input()
# print(judge)
if s == judge:
    ns = ns-1
elif t == judge:
    nt = nt -1
print(ns,nt)

Submission status: Accepted

Solution code:
balls_color1, balls_color2 = input().split()
balls_count1, balls_count2 = map(int, input().split())

balls = {
    balls_color1: balls_count1,
    balls_color2: balls_count2
}

trash = input()
balls[trash] -= 1

print(balls[balls_color1], balls[balls_color2])

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(A, B)

Submission status: Accepted

Solution code:
L = input().split()
S = L[0]
T = L[1]
a,b = map(int, input().split())
U = input()

if (U == S):
  a = a -1
elif(U == T):
  b = 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
elif u == t:
    b -= 1

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

Submission status: Accepted

Solution code:
def main():
  value1 = input().split()[0]
  count_list = input().split()

  if value1 == input():
    count_list[0] = str(int(count_list[0]) - 1)
  else:
    count_list[1] = str(int(count_list[1]) - 1)

  print(count_list[0] + ' ' + count_list[1])

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s,t = input().split(' ')
cs, ct = map(int,input().split(' '))
th = input()

if th == s:
    cs -= 1
else:
    ct -= 1
print(cs, ' ', ct)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = []
a = input().split()
S = a[0]
T = a[1]
b = []
b = input().split()
A = int(b[0])
B = int(b[1])
U = input()

#print('S, T = ', S, T)
#print('A, B = ', A, B)
#print('U = ', U)

if S == U:
  print(A-1, B)
if T == U:
  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
elif u == t:
  b-=1
print(a,b)

Submission status: Accepted

Solution code:
S, T = input().split()
a, b = input().split()
U = input()

a = int(a)
b = int(b)

if S==U:
  a-=1
if T==U:
  b-=1

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

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:
a,b=input().split()
q,w=map(int, input().split())
c=input()


if(a == c):
    print(q-1,w)
else:
    print(q,w-1)

Submission status: Accepted

Solution code:
flag = input().split()
S = flag[0]
T = flag[1]

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

print(A,B)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
strs = input().split()
nums = list(map(int, input().split()))
U = input()

# print(strs, nums, U)


if U == strs[0]:
    print(nums[0]-1, nums[1])
elif U == strs[1]:
    print(nums[0], nums[1]-1)
else:
    pass

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:
Color = input().split()
ColNum = list(map(int,input().split()))
Ball=input()

if(Ball == Color[0]):
  ColNum[0] -= 1
elif(Ball == Color[1]):
  ColNum[1] -= 1
else:
  print('error!')

print(str(ColNum[0]) + ' ' + str(ColNum[1]))

Submission status: Accepted

Solution code:
s, t = input().split()
a,b = map(int, input().split())
u = input()
res = {
    s: a,
    t: b
}
res[u] -= 1
print(res[s], res[t])

Submission status: Accepted

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

U=input()
if U==n[0]:
    m[0]-=1
else:
    m[1]-=1
print(str(m[0])+" "+str(m[1]))

Submission status: Accepted

Solution code:
S,T = input().split()
A,B = (int(x) for x in 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 S==U:
    A-=1
elif T==U:
    B-=1
print(A,B)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
input1 = input().split(" ")
input2 = input().split(" ")
input3 = input()
if input1[0] == input3 :
	print(str(int(input2[0])-1)+" "+input2[1])
elif input1[1] == input3:
    print(input2[0]+" "+str(int(input2[1])-1))

Submission status: Accepted

Solution code:
s, t = raw_input().split()
a, b = map(int, raw_input().split())
u = raw_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=input().split()
a,b=[int(x) for x in 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 = list(map(int,input().split()))
u = input()

a = A[0]
b = A[1]

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

print(a,b)

Submission status: Accepted

Solution code:
a = input().split()
b = [int(s) for s in input().split()]
c = input()

if (a[0] == c):
    b[0] = b[0] - 1
else:
    b[1] = b[1] - 1

print("{} {}".format(b[0], b[1]))

Submission status: Accepted

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

if U == S:
    l = [A-1, B]
else:
    l = [A, B-1]
    
print(l[0], l[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()

dic = {S:A,T:B}

if S == U:
    dic[S] = dic[S] - 1
    print(dic[S])
    print(dic[T])
elif T == U:
    dic[T] = dic[T] - 1
    print(dic[S])
    print(dic[T])

Submission status: Accepted

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

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

#処理
if S == U:
    A -= 1
else:
    B -= 1

#出力
print('{} {}'.format(A, B))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


TEST_INPUT = [
    """
    red blue
    3 4
    red
    """,
    """
    red blue
    5 5
    blue
    """
]
ANSWER = [
    "2 4",
    "5 4"
]


class InputHandler:

    def __init__(self, text_lines="", is_test=False):
        self.data = list(text_lines.split("\n"))
        self.index = 0
        self.is_test = is_test

    def input(self):
        if self.is_test:
            self.index += 1
            return self.data[self.index].strip()
        else:
            return sys.stdin.readline().rstrip()


def solve(s, t, a, b, u):
    if s == u:
        return str(a - 1) + " " + str(b)
    else:
        return str(a) + " " + str(b - 1)


def input_and_solve(ih):
    s, t = ih.input().split()
    a, b = map(int, ih.input().split())
    u = ih.input()
    res = solve(s, t, a, b, u)
    return res


def main():
    ih = InputHandler()
    res = input_and_solve(ih)
    print(res)


def test():
    for test_input, ans in zip(TEST_INPUT, ANSWER):
        ih = InputHandler(test_input, True)
        res = input_and_solve(ih)
        assert str(res) == str(ans)


if __name__ == "__main__":
    test()
    main()

Submission status: Accepted

Solution code:
lisST = input().split()
S=lisST[0]
T=lisST[1]
lisAB = input().split()
U = input()
A = int(lisAB[0])
B = int(lisAB[1])
if S == U:
    ansA, ansB = A-1, B
elif T == U:
    ansA, ansB = A, B-1
print(ansA, ' ', ansB)

Submission status: Accepted

Solution code:
import sys
[N, T] = list(map(str, input().split()))
[A, B] = list(map(int, input().split()))
U = input()
if (N == U):
    A -= 1
else:
    B -= 1
print("{} {}".format(A, B))
sys.stdout.flush

Submission status: Accepted

Solution code:
from collections import OrderedDict as d
a = list(map(str,input().split()))
m1 = d()
l = list(map(int,input().split()))
m1[a[0]]= l[0]
m1[a[1]] = l[1]
temp = input()
m1[temp]=m1[temp]-1
for i in m1.values():
  print(i,end=" ")

Submission status: Accepted

Solution code:
import numpy as np
 
color = input().split(" ")
count = np.array(input().split(" "), dtype="int64")
choose = input()
 
a = color.index(choose)
count[a] -= 1
print(count[0], end=" ")
print(count[1])

Submission status: Accepted

Solution code:
a = input().split()
b = input().split()
c = input()

if a[0] == c :
    ans = str(int(b[0]) - 1) + " " + b[1]
else :
    ans = b[0] + " " + str(int(b[1]) - 1)

print(ans)

Submission status: Accepted

Solution code:
def acinput():
    return list(map(int, input().split(" ")))



import numpy as np
#from functools import reduce
import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect
import sys
import random
import time
import copy
import functools

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

d={}
d[S]=A
d[T]=B
d[U]-=1
print(d[S],d[T])

Submission status: Accepted

Solution code:
input_line_str = input().split(" ")
input_line_num = [int(i) for i in input().split(" ")]

input_line_num[input_line_str.index(input())] -= 1
print(" ".join([str(i) for i in input_line_num]))

Submission status: Accepted

Solution code:
S, T = input().split()
A, B = [int(i) for i in 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()) #input()はstrで取る。よってintで方指定する。
a , b  = map(int,input().split()) #input()はstrで取る。よってintで方指定する。
u = input()

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


print(a,b)

Submission status: Accepted

Solution code:
s = input().split()
s_=s[0]
t=s[1]
s = input().split()
a=int(s[0])
b=int(s[1])
s = input().split()
if s[0] in s_:
    print(a-1,b)
elif s[0] in t:
    print(a,b-1)
else:
    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
elif U == T:
  B-=1
else:
  print("0")

print(str(A)+" "+str(B))

Submission status: Accepted

Solution code:
S, T = input().split()
A, B = map(int, input().split())
U = input()
'''
print(S)
print(T)
print(A)
print(B)
print(U)
'''
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 = A - 1
  b = B
else :
  a = A
  b = 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=a-1
if t==u:
    b=b-1
print(a,b)

Submission status: Accepted

Solution code:
S, T = input().split()
s_i, t_i = map(int, input().split())
U = input()

if U == S:
    print(str(s_i - 1) + " " + str(t_i))
else:
    print(str(s_i) + " " + str(t_i - 1))

Submission status: Accepted

Solution code:
S,T=input().split()

N_S,N_T=input().split()

N_S=int(N_S)
N_T=int(N_T)
U=input()

if S==U:
	print(N_S-1,N_T)
else:
	print(N_S,N_T-1)

Submission status: Accepted

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

if u == s:
	print('{0} {1}'.format(a-1, b))
else:
	print('{0} {1}'.format(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:
A, B = input().split()
a, b = [int(i) for i in input().split()]
s = input()
if s==A:
    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:
a,b = input().split()
x,y = [int(x) for x in input().split()]
trash = input()
if trash == a:
  print((x-1), y)
elif trash == b:
  print(x, (y-1))
else:
  print(x,y)

Submission status: Accepted

Solution code:
from sys import stdin
A, B= stdin.readline().rstrip().split()
m = [A,B]
k = list(map(int, input().split()))
l = stdin.readline().rstrip().split()
k[m.index(l[0])] = k[m.index(l[0])] -1
print(k[0],k[1])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!python3.4
# -*- coding: utf-8 -*-
# abc154/abc154_a
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    S,T = i2s().split()
    A,B = i2nn()
    U = i2s()
    d = {S:A, T:B}
    d[U] -= 1
    print(d[S], d[T])
    return

main()

Submission status: Accepted

Solution code:
S = str(input())
T = input()
arr1 = [i for i in S.split(' ')]
arr2 = [int(j) for j in T.split(' ')]
U = str(input())

if(U == arr1[1]):
	arr2[1] = arr2[1] - 1
	print(str(arr2[0])+' '+str(arr2[1]))
else:
	arr2[0] = arr2[0] - 1
	print(str(arr2[0])+' '+str(arr2[1]))

Submission status: Accepted

Solution code:
list_str = [str(e) for e in input().split()]
list_num = [int(e) for e in input().split()]
drop = [str(e) for e in input().split()]
if drop[0] == list_str[0]:
    list_num[0] = list_num[0]-1
elif drop[0] == list_str[1]:
    list_num[1] = list_num[1]-1
print('{} {}'.format(list_num[0], list_num[1]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input().split()
t = input().split()
u = input()
if s[0] == u:
  print("{} {}".format(str(int(t[0])-1), str(int(t[1]))))
else:
  print("{} {}".format(str(int(t[0])), str(int(t[1])-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 = str(input())

s_count = a
t_count = b

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
name = input().split(' ')
num  = [int(a) for a in input().split(' ')] 
trash = input()


ind = name.index(trash)
num[ind] -= 1

print(
  '{} {}'.format(num[0],num[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 = map(str,input().split())
A, B = map(int,input().split())
U = str(input())

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

Submission status: Accepted

Solution code:
S, T = input().split()

A, B = [int(i) for i in 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 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:
    A -= 1
elif T == U:
    B -= 1
print('{} {}'.format(A, B))

Submission status: Accepted

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



print(str(d[s]) + ' ' + str(d[t]))

Submission status: Accepted

Solution code:
S, T = input().split()
A, B = [int(n) for n in input().split()]
ans = {S:A, T:B}
U = input()
ans[U] -= 1
print(ans[S], ans[T])

Submission status: Accepted

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

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 = 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:
inpl = lambda: list(map(int,input().split()))
S, T = input().split()
A, B = inpl()
U = input()
if U == S:
    A -= 1
else:
    B -= 1
print(A, B)

Submission status: Accepted

Solution code:
S, T = input().split()
A, B = [int(_) for _ in 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 S == U:
    print(A-1)
    print(B)
else:
    print(A)
    print(B-1)

Submission status: Accepted

Solution code:
balls = input().split(' ')
nums = [int(x) for x in input().split(' ')]

u = input()
for i, b in enumerate(balls):
    if b == u:
        nums[i] -= 1

print(' '.join(list(map(str, nums))))

Submission status: Accepted

Solution code:
a = input().split()
b = input().split()
c = input()
if a[0] == c:
    print(str(int(b[0]) - 1) + " " + b[1])
else:
    print(b[0] + " " + str(int(b[1]) - 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(a,b)

Submission status: Accepted

Solution code:
def a():
    s, t  = input().split()
    s_n, t_n = input().split()
    u = input()
    if u == s:
        s_n = int(s_n) - 1
    elif t == u:
        t_n = int(t_n) - 1
    return str(s_n) + " " + str(t_n)
print(a())

Submission status: Accepted

Solution code:
# A = input()
# A = int(input())
# A = map(int, input().split())
# A = list(map(int, input().split()))
# A = [int(input()) for i in range(N)]
#
# c = collections.Counter()

import collections

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:
a = list(map(str, input().split()))
b = list(map(int, input().split()))
c = list(map(str, input().split()))
if a[0] == c[0]:
	b[0] = b[0] - 1
else: b[1] = b[1] -1
print(b[0],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(A, B)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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 = input().split(' ')
a, b = map(int, input().split())
u = input()

if s[0] == u:
    a -= 1
else:
    b -= 1
print(str(a) + ' ' + str(b))

Submission status: Accepted

Solution code:

H = list(map(str,input().split()))
W = list(map(int, input().split()))

color = input()

# print(H,W,color)
idx = H.index(color)

W[idx] = W[idx] - 1

print(W[0], W[1])

Submission status: Accepted

Solution code:
r, b= map(str, input().split())
rn, bn= map(int, input().split())
s = input()

if(s==r):
    print(rn-1, bn)
else:
    print(rn,bn-1)

Submission status: Accepted

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

A = int(a)
B = int(b)

if u == s:
    print(A -1, B)
else:
    print(A, B - 1)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
a,b=input().split()
num=list(map(int,input().split()))

U=input()

if U==a:
    num[0]-=1
else:
    num[1]-=1

print(*num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
st = input().split()
num = [int(i) for i in input().split()]
pick = input()

if (pick == st[0]):
  print(num[0]-1, num[1])
else:
  print(num[0], num[1]-1)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S, T = list(input().split())
A, B = list(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 = input().split()
u = input()
if u == s:
    a = int(a)
    a -= 1
else:
    b = int(b)
    b -= 1
print(a, b)

Submission status: Accepted

Solution code:
a,b = input().split()
c,d = map(int, input().split())
e = input()

if ( a == e ):
  c = c - 1
elif ( b == e ):
  d = d - 1
print(str(c) + " " + str(d) )

Submission status: Accepted

Solution code:
S,T=list(map(str, input().split())) 
A,B=list(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:
c = input().rstrip().split(' ')
number = input().rstrip().split(' ')
num1 = int(number[0])
num2 = int(number[1])
ans = input()

if c[0]==ans:
    num1 -= 1
elif c[1]==ans:
    num2 -= 1

print(str(num1) +' '+ str(num2))

Submission status: Accepted

Solution code:
def main(s, t, a, b, u):
    d = {s: a, t: b}

    d[u] -= 1

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


if __name__ == "__main__":
    s, t = input().split()
    a, b = map(int, input().split())
    u = input()

    main(s, t, a, b, u)

Submission status: Accepted

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

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
if u == t:
  b = b - 1

print(str(a)+" "+str(b))

Submission status: Accepted

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

if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
s, t = list(input().split())
a, b = list(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=(input().split())
U=input()
if(U==S):
    print(int(A)-1,int(B))
if(U==T):
    print(int(A),int(B)-1)

Submission status: Accepted

Solution code:

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

#print(S)
##print(T)
#print(A)
#print(U)

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:
  print(str(a-1)+ ' '+str(b))
else:
  print(str(a)+ ' '+str(b-1))