N,i= list(map(int,input().split()))                                                                                     



print((N-i+1))
n, i = list(map(int, input().split()))

print((n + 1 - i))

N, i = list(map(int, input().split()))
print((N - i + 1))

n, i = list(map(int, input().split()))
print((n + 1 - i))

-N, i = list(map(int, input().split())) -print((N - i + 1)) +n, i = list(map(int, input().split())) +print((n + 1 - i))