x = 0 for _ in [0]*int(input()): K, L, D = map(int, input().split()) L2 = L>>D while(K>0 and L2%4!=0): x ^= L L += 1<