print(' '.join((lambda x:[str((x[2]-1)) if x[4] == x[0] else str(x[2]),str((x[3]-1)) if x[4] == x[1] else str(x[3])])(input().split()+list(map(int,input().split()))+[input()]))) print(' '.join((lambda x:[str((x[2]-1)) if x[4] == x[0] else str(x[2]),str((x[3]-1)) if x[4] == x[1] else str(x[3])])(input().split()+list(map(int,input().split()))+[input()]))) print ' '.join((lambda x:[str((x[2]-1)) if x[4] == x[0] else str(x[2]),str((x[3]-1)) if x[4] == x[1] else str(x[3])])(input().split()+list(map(int,input().split()))+[input()])) ' '.join ' ' join (lambda x:[str((x[2]-1)) if x[4] == x[0] else str(x[2]),str((x[3]-1)) if x[4] == x[1] else str(x[3])])(input().split()+list(map(int,input().split()))+[input()]) lambda x:[str((x[2]-1)) if x[4] == x[0] else str(x[2]),str((x[3]-1)) if x[4] == x[1] else str(x[3])] [str((x[2]-1)) if x[4] == x[0] else str(x[2]),str((x[3]-1)) if x[4] == x[1] else str(x[3])] str((x[2]-1)) if x[4] == x[0] else str(x[2]) x[4] == x[0] x[4] x 4 x[0] x 0 str((x[2]-1)) str x[2]-1 x[2] x 2 1 str(x[2]) str x[2] x 2 str((x[3]-1)) if x[4] == x[1] else str(x[3]) x[4] == x[1] x[4] x 4 x[1] x 1 str((x[3]-1)) str x[3]-1 x[3] x 3 1 str(x[3]) str x[3] x 3 x input().split()+list(map(int,input().split()))+[input()] input().split()+list(map(int,input().split())) input().split() ().split () input split list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split [input()] input() input
print(' '.join((lambda x:[str((x[2]-1)) if x[4] == x[0] else str(x[2]),str((x[3]-1)) if x[4] == x[1] else str(x[3])])(input().split()+list(map(int,input().split()))+[input()])))