i = int(input())k = 0l = 0for j in range(i): a ,b = map(int, input().split()) if a == 0: k + 1 elif b == 1: l + 1 elif a == 2: k - 1 elif b == 3: l - 1 print (k ,l)