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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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)  # 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:
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
import sys
# input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return map(int,input().split())
def LI(): return list(map(int,input().split()))

def main():
    S,T = input().split()
    A,B = MAP()
    U = input()

    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("{} {}".format(a-1, b))
else:
  print("{} {}".format(a, b-1))

Submission status: Accepted

Solution code:
S,T = 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 = (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 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:
    print("{} {}".format((a -1), b))
else:
    print("{} {}".format(a, (b -1)))

Submission status: Accepted

Solution code:
S, T = map(str, input().split())
N, M = map(int, input().split())
U = str(input())
if S == U:
  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 = str(input())

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

Submission status: Accepted

Solution code:
# import math
# import bisect
# import heapq
# from collections import deque
# import numpy as np

# a,b,c = map(int, input().split())
# n = int(input())
# a = list(map(int,input().split()))
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()
s,t = map(int,input().split())

if input() == S:
  s -= 1
else:
  t -= 1
  
print(s,t)

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:
s,t = input().split()
a,b = map(int,input().split())
u = 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())
u=input()
if u==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=input()

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

Submission status: Accepted

Solution code:
list1 = input().split(" ")
list2 = input().split(" ")
U = input()
S = list1[0]
T = list1[1]
A = int(list2[0])
B = int(list2[1])

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

Submission status: Accepted

Solution code:
word = input().split()
a, b = map(int, input().split())
target = input()
if word[0] == target:
  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):
    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=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

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

Submission status: Accepted

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

print(A,B)

Submission status: Accepted

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

if U == X:
  print(A-1, end=' ')
  print(B)
else:
  print(A, end=' ')
  print(B-1)

Submission status: Accepted

Solution code:
S,T = input().split()
A,B = map(int,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, a, b, u = open(0).read().split()
d = {s:int(a), t:int(b)}
d[u] -= 1
print(d[s], d[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)
else :
    print(a,b-1)

Submission status: Accepted

Solution code:
import sys
msg = sys.stdin.readlines()
a = []
for x in msg:
  for y in x.replace('\n', '').split(' '):
    a.append(y)
ind1 = a[0]
ind2 = a[1]
val1 = int(a[2])
val2 = int(a[3])
if ind1 == a[4]:
  val1 -= 1
else:
  val2 -= 1

print(val1, val2)

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, T = input().split()
A, B = list(map(int, input().split()))
U = input()

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

Submission status: Accepted

Solution code:
color = input().split()

num = input().split()
a = int(num[0])
b = int(num[1])


u = input()
if u == color[0]:
    a -= 1
elif u == color[1]:
    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 = str(input())
if u == s:
    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:
  print(c-1,d)
else:
  print(c,d-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:
li = input().split()
a,b=map(int,input().split())
dec=input()
if li[0]==dec:
  print(a-1,b)
else:
  print(a,b-1)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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


if __name__ == "__main__":
    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(' '.join(map(str,[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(A-1,B)
elif U==T:
    print(A,B-1)

Submission status: Accepted

Solution code:
name_a,name_b=(str(x) for x in input().split())
a_count,b_count=(int(x) for x in input().split())
fetch_color=input()
ans,bns=0,0
if fetch_color==name_a:
  ans = a_count-1
  bns = b_count
elif fetch_color==name_b:
  bns = b_count-1
  ans = a_count
print(ans,bns)

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 = 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:
  a -= 1
else:
  b -= 1
print('{0} {1}'.format(a,b))

Submission status: Accepted

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

i = list(map(int, input().split()))
A = i[0]
B = i[1]

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)
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:
a,b = input().split()
c,d = map(int,input().split())
e =input()
 
if a == e:
		print(c-1,d)
		
else:
		print(c,d-1)

Submission status: Accepted

Solution code:
st = input().split()
AB = input().split()
U = input()
s = st[0]
t = st[1]
A = int(AB[0])
B = int(AB[1])

if s == U:
    A = A - 1

if t == U:
    B = B - 1

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

Submission status: Accepted

Solution code:
S,  T = input().split()
r, b = map(int, input().split())
N = input()
 
if S == N:
  r -= 1
elif T == N:
  b -= 1
  
 
print(r, b)

Submission status: Accepted

Solution code:
S, T = 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 U == S:
  print(A-1,B)
else:
  print(A, B-1)

Submission status: Accepted

Solution code:
def main():
  S, T = input().split()
  A, B = list(map(int, input().split()))
  U = input()
  if S == U:
    A -= 1
  else:
    B -= 1
  print(A, B)
    
if __name__ == '__main__':
  main()

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())
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(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 = 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 = input()
if u == s:
  a = a-1
elif u == t:
  b = b-1

print(a,b)

Submission status: Accepted

Solution code:
def solve():
    S, T = input().split()
    A, B = map(int, input().split())
    U = input()
    ans = [A-1, B] if U == S else [A, B-1]
    print(*ans)

solve()

Submission status: Accepted

Solution code:
def solve():
    S, T = input().split()
    A, B = map(int, input().split())
    U = input()
    if U == S:
        A -= 1
    else:
        B -=1
    ans = [A, B]
    print(*ans)

# print(solve())

# def solve()が@return voidのとき
solve()

Submission status: Accepted

Solution code:
a, b = input().split()
anum, bnum = map(int, input().split())
key = input()
if a == key:
  anum -= 1
else:
  bnum -= 1
print(anum, bnum)

Submission status: Accepted

Solution code:
def main():
    st = input().split()
    ab = list(map(int, input().split()))
    u = input()

    indx = st.index(u)
    ab[indx] -= 1
    a, b = ab
    print(a, b)


if __name__ == "__main__":
    main()

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 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 s==input():
  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:
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())
c = input()
if c == 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:
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 = input()
if U == S:
    A -= 1
elif U == T:
    B -= 1
print(A,B)

Submission status: Accepted

Solution code:
a=[str(i) for i in input().split()]
b=[int(i) for i in input().split()]
c=input().strip()
x=b[0]
y=b[1]
if a[0]==c:
	b[0]=b[0]-1
elif a[1]==c:
	b[1]=b[1]-1

print(' '.join(map(str, b)))

Submission status: Accepted

Solution code:
# A - Remaining Balls
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().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 = A -1
if U == T:
  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 (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=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=str(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:
    print(A-1, B)
else:
    print(A, B-1)

Submission status: Accepted

Solution code:
A,B = map(str,input().split())
AM,BM = map(int,input().split())
ans = input()

if ans == A:
    AM -= 1
else:
    BM -= 1

print(AM,BM)

Submission status: Accepted

Solution code:
S, T = 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 = map(int, input().split())
u = input()

if s==u:
  a -= 1
elif t==u:
  b -= 1
ans=[a,b] 

print(*ans)

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

s,t = input().split()
a,b = inpl()
w = input()
if s == w:
    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('{} {}'.format(A, B))

Submission status: Accepted

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

Submission status: Accepted

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

status = {s:a, t:b}

for k, v in status.items():
    if u == k:
        status[k] = status[k] - 1

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

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())
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 = 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(x) for x in input().split()]
u = input()
if (s == u):
    a -= 1
else:
    b -= 1
print(a,b)

Submission status: Accepted

Solution code:
def main():
    st = list(map(str, input().split()))
    num = list(map(int,input().split()))
    u = str(input())
    if st[0]==u:
        num[0]-=1
    else:
        num[1]-=1
    print(num[0],num[1])

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = list(map(str, input().split()))
X = list(map(int, input().split()))
U = input()

for i in range(2):
    if S[i] == U:
        X[i] -= 1

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

Submission status: Accepted

Solution code:
from sys import stdin

S,T = stdin.readline().rstrip().split()
A,B = [int(x) for x in stdin.readline().rstrip().split()]
U = stdin.readline().rstrip().split()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S,T=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 = map(str,input().split())
A, B = map(int, input().split())
U = input()
ans = 0

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

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(str(A) + " " + str(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(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("{}" "{}" "{}".format(a-1," ",b))
else:
    print("{}" "{}" "{}".format(a," ",b-1))

Submission status: Accepted

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

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

print("{}" "{}" "{}".format(c," ",d))

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 = (int(x) for x in input().split())
u = input()

if u==s:
    print("{} {}".format(a-1,b))
else:
    print("{} {}".format(a,b-1))

Submission status: Accepted

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

if li[1] == U:
    B -= 1
    print(A,B)
else:
    A -= 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:
A, B = input().split()
L  = list(map(int, input().split()))
C = input()

if A == C:
    print(str(L[0] - 1) + " " + str(L[1]))
if B == C:
    print(str(L[0]) + " " + str(L[1] - 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=input().split();A=list(map(int,input().split()));A[input()==S[1]]-=1;print(A[0],A[1])

Submission status: Accepted

Solution code:
i1, i2 = input().split()
j1, j2 = map(int,input().split())
k = input()

if k == i1:
  j1 -= 1
else:
  j2 -= 1
  
print(str(j1), str(j2))

Submission status: Accepted

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

dic = {s:a,t:b}

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)
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 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 = str(input())

h1 = {}
h1[s] = a
h1[t] = b

h1[u] = h1[u] - 1

print(h1[s],h1[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)
else:
    print(a, b-1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S, T = input().split()
X = {}
X[S], X[T] = [int(_) for _ in input().split()]

U = input()
X[U] -= 1

print(X[S], X[T])

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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

Submission status: Accepted

Solution code:
T,S = input().split()
A,B = map(int,input().split())
U = input()
Z = [A+[0,-1][U == T],B+[0,-1][U == S]]
O = map(str,Z)
agy = ' '.join(O)
print(agy)

Submission status: Accepted

Solution code:
l = input().split()
m, n = list(map(int, input().split()))
s = input()
if s == l[0]:
    a = m - 1
    print(a, end = " ")
    print(n)

if s == l[1]:
    b = n - 1
    print(m, end =" ")
    print(b)

Submission status: Accepted

Solution code:
S, T = [str(s) for s in input().split()]
A, B = [int(i) for i in input().split()]
U = str(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 S==U:
    print(A-1,B)
elif T==U:
    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):
    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())
if u == s:
  a-=1
else:
  b-=1
print(a,b)

Submission status: Accepted

Solution code:
col=list(map(str,input().split()))
num=list(map(int,input().split()))
U=str(input())
if U == col[0]:
  num[0] = num[0]-1
elif U == col[1]:
  num[1] = num[1]-1
[print(num[i],end=" ") for i in range(2)]

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
else:
  b = b - 1
print('{} {}'.format(a,b))

Submission status: Accepted

Solution code:
a=list(map(str,input().split()))
b=list(map(int,input().split()))
b[a.index(input())]-=1
print(*b)

Submission status: Accepted

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

    if(S == U):
        result = [A - 1,B]

    if(T == U):
        result = [A,B - 1]

    print(" ".join(list(map(str,result))))

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

Submission status: Accepted

Solution code:
S, T = tuple(input().split())
A, B = tuple(map(int, input().split()))
U = input()
dic = {S : A, T : B}
dic[U] -= 1
print(str(dic[S]) + " " + str(dic[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:
st = [s for s in input().split()]
ab = [int(s) for s in input().split()]
u = input()

if u == st[0]:
  print(int(ab[0]-1),int(ab[1]))
else:
  print(int(ab[0]),int(ab[1]-1))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(a,b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S, T = list(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 = map(str, input().split())
a, b = map(int, input().split())
u = str(input())

if u == s:
  print(int(a-1), int(b))
else:
  print(int(a), int(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))
elif T==U :
  print(str(A)+" "+str(B-1))

Submission status: Accepted

Solution code:
S,T = input().split(" ")
A,B = [int(i) for i in 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 = [elem for elem in input().split()]
a, b = [int(elem) for elem in input().split()]
u = input()

dic = {}
dic[s] = a
dic[t] = b
if u == s:
  dic[s] -= 1
else:
  dic[t] -= 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(str(A-1)+" "+str(B))
elif T==U :
	print(str(A)+" "+str(B-1))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
S, T = input().split()
A, B = map(int,input().split())
U = input()

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


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:
    print(A-1,B)
else:
    print(A,B-1)

Submission status: Accepted

Solution code:
def remaining_balls_number(dict_sum_of_each_balls, remove_balls_color):
    if dict_sum_of_each_balls[remove_balls_color]:
        now_number = dict_sum_of_each_balls[remove_balls_color]
        dict_sum_of_each_balls[remove_balls_color] = now_number - 1
    return dict_sum_of_each_balls


if __name__ == '__main__':
    a_color, b_color = input().split()
    a_number, b_number = map(int, input().split())
    remove_color_ball = input()
    answer = remaining_balls_number(
        {a_color: a_number, b_color: b_number}, remove_color_ball)
    print(answer[a_color], answer[b_color])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s,t=map(str,input().split())
q,w=map(int,input().split())
Q=input()
print("{} {}".format(q-1,w) if Q==s else "{} {}".format(q,w-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))
elif T==U:
	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:
    a -= 1
elif u == t:
    b -= 1

print(a, b)

Submission status: Accepted

Solution code:
import numpy as np

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