for i in range(int(input())): t, *r = map(int, input().split()) ans = sum(r) if t == 1 else i + 1 print(ans)