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])) s, t = input().split() s input().split() ().split () input split t a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b u = input() u input() input countdict = {} countdict {} countdict[s] = a countdict[s] countdict s a countdict[t] = b countdict[t] countdict t b countdict[u] -= 1 countdict[u] countdict u 1 print(str(countdict[s]) + " " + str(countdict[t])) print str(countdict[s]) + " " + str(countdict[t]) str(countdict[s]) + " " str(countdict[s]) str countdict[s] countdict s " " str(countdict[t]) str countdict[t] countdict t b = map(int, input().split()) map(int, input().split()) b countdict = {} {} countdict u = input() input() u a, b = map(int, input().split()) map(int, input().split()) a s, t = input().split() input().split() s t = input().split() input().split() t
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]))