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:
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


s, t = input().split()
a, b = inpl()
u = input()[:-1]
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
elif t==u:
  b=b-1

print(a, b)

Submission status: Accepted

Solution code:
from sys import stdin, setrecursionlimit


def main():
    input = stdin.readline
    s, t = map(str, input().split())
    a, b = map(int, input().split())
    u = input()[:-1]
    print(a - 1, b) if s == u else print(a, b - 1)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Submission status: Accepted

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


def main():
    S, T = input().split()
    A, B = map(int, input().split())
    U = input().strip()
    print(A-1, B) if S == U 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 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= 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 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 = list(map(str, input().split()))
I = list(map(int, input().split()))
U = input()
print(I[0] - (U == S[0]), I[1] - (U == S[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:
  a -= 1
else:
  b -= 1
  
print(a,b)

Submission status: Accepted

Solution code:
S, T = list(map(str, 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 = list(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 = list(map(str, 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()
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(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
elif U == T:
    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:
    print(a-1,b)
else:
    print(a,b-1)

Submission status: Accepted

Solution code:
S, T = [i for i in 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:
import sys
import collections
input = sys.stdin.readline

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

print(A,B)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
color = input()

kosuu = input()

trashc = input()

_ = 0

color = color.split()
kosuu = kosuu.split()
trashc = trashc.split()


while True:
  if(trashc[0] == color[_]):
    kosuu[_] = int(kosuu[_]) -1
    break
      
  _= _+1
    
print(" ".join(map(str, kosuu)))

Submission status: Accepted

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

d = {S: A, T: B}
d[U] -= 1

print('{} {}'.format(d[S], d[T]))

Submission status: Accepted

Solution code:
s, t = (x for x in raw_input().split())
a, b = (int(x) for x in raw_input().split())
u = raw_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 (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(a-1,b)
elif u == 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:
  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 or T == U:
  print(A - int(S==U), B - int(T==U))

Submission status: Accepted

Solution code:
r,b = input().split()
n,m = map(int, input().split())
kai = input()

if r == kai:
    n-=1
    
else:
    m-=1
    
print(n,m)

Submission status: Accepted

Solution code:
S,T = input().split()
A,B = map(int, input().split())
U = input()
# N = int(input())
# s = int(input())
# C = int(input())
# s= 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
elif T == U:
  B -= 1
print(A, B)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

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

    print(*ans)


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:
c = input().split()
n = list(map(int, input().split()))
if input() == c[0]:
    n[0] -= 1
else:
    n[1] -= 1
print(n[0], n[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=list(input().split())
A,B=list(map(int,input().split()))
U=input()
D={}
D[S]=A
D[T]=B
D[U]-=1
print(D[S],D[T])

Submission status: Accepted

Solution code:
l = {}
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:
import fileinput

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:
def ABC_154_A():
    S,T = map(str, 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))

if __name__ == '__main__':

    ABC_154_A()

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 = 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=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=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 = (int(x) for x in 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:
array = []

for i in range(3):
    val = input().split()
    array.append(val)

A,B = [int(s) for s in array[1]]

if array[2][0] == array[0][0]:
    print(str(A - 1) + " " + str(B))
else:
    print(str(A) + " " + str(B - 1))

Submission status: Accepted

Solution code:
import itertools
import math
import fractions
import functools
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(i) for i in input().split())
U = input()


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

Submission status: Accepted

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

s = x[0]
t = x[1]

y = input().split()

a = int(y[0])
b = int(y[1])

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

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

Submission status: Accepted

Solution code:
s1, s2 = input().split()
n1, n2 = map(int, input().split())
u = input()
if u == s1:
  n1 -= 1
else:
  n2 -= 1
print(n1, n2)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Fri May  8 14:17:18 2020

@author: shinba
"""
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, H = map(int, input().split())

counter = {
    S: A,
    T: H
}

U = input()

counter[U] -= 1

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

Submission status: Accepted

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

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

print(str(countdict[s]) + " " + str(countdict[t]))

Submission status: Accepted

Solution code:
S, T = map(str,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 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(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())

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

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:
(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:
from sys import stdin, setrecursionlimit


def main():
    s, t = map(str, stdin.readline().split())
    a, b = map(int, stdin.readline().split())
    u = stdin.readline()[:-1]

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

    print(a, b)


if __name__ == "__main__":
    setrecursionlimit(10000)
    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:
a=input().split()
b,c=map(int,input().split())
d=input()
if a[0]==d:
    print(b-1,c)
else:
    print(b,c-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:
  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:
    print(A-1,B)
else:
    print(A,B-1)

Submission status: Accepted

Solution code:
String = list(input().split())
Number = list(map(int,input().split()))
U = input()

if U == String[0]:
    num = Number[0]-1
    print(num,Number[1])
elif U == String[1]:
    num = Number[1] - 1
    print(Number[0], num)
else:
    print("Error")

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 = list(map(int,input().strip().split()))
print(*((a-1,b) if input() == s else (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()
li = list(map(int,input().split()))
if S==input():
 li[0]-=1
else:
 li[1]-=1
print(*li)

Submission status: Accepted

Solution code:
S, T  = input().split()
SN, TN  = input().split()
C = input()
m = {}
m[S] = int(SN)
m[T] = int(TN)
m[C] -= 1
print(str(m[S]) + ' ' + str(m[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())
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 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:
# A - Remaining Balls

S, T = map(str, input().split())
A, B = map(int, input().split())
U = str(input())
print(*((A - 1, B) if S == U else (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
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)
elif T == U:
    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:
    print("{} {}".format(a-1, b))
elif u == t:
    print("{} {}".format(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)
if t == u:
    print(a, b-1)

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

s, t = Ss()
a, b = Is()
u = S()

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
s,t = [i.rstrip() for i in readline().split()]
a,b = [int(i) for i in readline().split()]
u = readline().rstrip()

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 = input().split()
A, B = map(int, input().split())
U = input()
ans = [A, B]
if U == S:
    ans[0] = A - 1
else:
    ans[1] = B - 1
print(" ".join(map(str, ans)))

Submission status: Accepted

Solution code:
s, t = input().split()
a, b = map(int, input().split())
u = input()
d = {s : a, t: b}
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()
d = {s : a, t: b}
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 -= 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 = 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 s==u:
    a=a-1
if t==u:
    b=b-1
print(a,b)

Submission status: Accepted

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

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(str(dic[s]) + ' ' + str(dic[t]))

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=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 = 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 S == U:
  A -= 1
  print(A, B)
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()
scounter = a 
tcounter = b
if s == u:
	scounter -= 1
else:
	tcounter -= 1
print(scounter,tcounter)

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 s!=u else b))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
x, y = input().split()
a, b = map(int,input().split())
z = input()
if (z == x):
    a -= 1 
elif(z == y):
    b -= 1
else:
    pass
print(str(a) + " " + str(b))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
S, T = input().split()
A, B = input().split()
U = input()

def main(x1, x2, y1, y2, z):
    if (z == x1):
        y1 = int(y1) - 1 
    elif(z == x2):
        y2 = int(y2) - 1
    else:
        pass
    print(str(y1) + " " + str(y2))

main(S, T, A, B, U)

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

if U == S:
    print(A - 1, B)
elif U == T:
    print(A, B - 1)
else:
    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
else:
    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:
  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:
def solve():
    s, t = input().split()
    a, b = map(int, input().split())
    mp = {s:a, t:b}
    u = input()
    mp[u] -= 1
    return mp[s], mp[t]

ans = solve()
print(*ans)

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 = 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:
S,T = map(str,input().split())
X,Y = map(int,input().split())
Z = input()
if S==Z:
  print(X-1,Y)
elif T==Z:
    print(X,Y-1)
else:
    print(X,Y)

Submission status: Accepted

Solution code:
S, T = map(str, 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()
tm = {}
a,b=map(int,input().split())
tm[s]=a
tm[t]=b
tm[input()]-=1
print(tm[s],tm[t])

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################
li = input().split()
#print(li)
x,y = map(int,input().split())	
s =input()
if s==li[0]:
    print(x-1,y)
else:
    print(x,y-1)

Submission status: Accepted

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

if n==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()
ans=[]
if u==s:
  ans.append(str(a-1))
  ans.append(str(b))
else:
  ans.append(str(a))
  ans.append(str(b-1))
print(" ".join(ans))

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 -= 1
else:
    b -= 1

print(a, b)

Submission status: Accepted

Solution code:
s, t, a, b, u = open(0).read().split()
a, b = int(a), int(b)
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=(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:
S,T = list(map(str, 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=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=input().split()
b = {}
a = list(map(int, input().split()))

for i in range(2):
  b[s[i]] = a[i]
  
b[input()] -=1

print(str(b[s[0]])+" "+str(b[s[1]]))

Submission status: Accepted

Solution code:
il1 = input().split()
il2 = [int(k) for k in input().split()]
S = il1[0]
T = il1[1]
A = il2[0]
B = il2[1]
U = input()
if (S.find(U) >= 0):
    A = A-1
if (T.find(U) >= 0):
    B = 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 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=str(input())
if a==e:
    print(c-1,d)
else:
    print(c,d-1)

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

Submission status: Accepted

Solution code:

s,t,a,b,u= map(str, open(0).read().split())
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 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())
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 = str(input())
if S == U:
    A -= 1
else:
    B -= 1
print("{0} {1}".format(A, B))