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

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

main() mod = 1e9+7 mod 1e9+7 1e9 7 def add(a, b):
    c = a + b
    if c >= mod:
        c -= mod
    return c add c = a + b c a + b a b if c >= mod:
        c -= mod
     c >= mod c mod c -= mod c mod return c c a a b b def main():
    A, B = [x for x in raw_input().split()]
    
    A_cnt, B_cnt = [int(x) for x in raw_input().split()]
    
    throw_away = raw_input()
    
    if throw_away == A:
        A_cnt -= 1
    else:
        B_cnt -= 1
    
    print(str(A_cnt) + " " + str(B_cnt))
     main x for x in raw_input().split() for x in raw_input().split() x raw_input().split() ().split () raw_input split for x in raw_input().split() x A, B = [x for x in raw_input().split()] A [x for x in raw_input().split()] B int(x) for x in raw_input().split() for x in raw_input().split() x raw_input().split() ().split () raw_input split for x in raw_input().split() int(x) int x A_cnt, B_cnt = [int(x) for x in raw_input().split()] A_cnt [int(x) for x in raw_input().split()] B_cnt throw_away = raw_input() throw_away raw_input() raw_input if throw_away == A:
        A_cnt -= 1
    else:
        B_cnt -= 1
    
     throw_away == A throw_away A A_cnt -= 1 A_cnt 1 B_cnt -= 1 B_cnt 1 print(str(A_cnt) + " " + str(B_cnt)) print str(A_cnt) + " " + str(B_cnt) str(A_cnt) + " " str(A_cnt) str A_cnt " " str(B_cnt) str B_cnt main() main mod = 1e9+7 1e9+7 mod def main():
    A, B = [x for x in raw_input().split()]
    
    A_cnt, B_cnt = [int(x) for x in raw_input().split()]
    
    throw_away = raw_input()
    
    if throw_away == A:
        A_cnt -= 1
    else:
        B_cnt -= 1
    
    print(str(A_cnt) + " " + str(B_cnt))
     def main():
    A, B = [x for x in raw_input().split()]
    
    A_cnt, B_cnt = [int(x) for x in raw_input().split()]
    
    throw_away = raw_input()
    
    if throw_away == A:
        A_cnt -= 1
    else:
        B_cnt -= 1
    
    print(str(A_cnt) + " " + str(B_cnt))
     main def add(a, b):
    c = a + b
    if c >= mod:
        c -= mod
    return c def add(a, b):
    c = a + b
    if c >= mod:
        c -= mod
    return c add
mod = 1e9+7
def add(a, b):
    c = a + b
    if c >= mod:
        c -= mod
    return c

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

main()