#include #include typedef long long ll; #define REP(i,a,b) for(ll (i)=a;(i)<(ll)(b);++(i)) #define rep(i,n) REP(i,0,n) int main(){ ll N; scanf("%lld", &N); ll x = 0; rep(i, N){ ll K, L, D; scanf("%lld%lld%lld", &K, &L, &D); ll L2 = L>>D; while(K>0 && L2%4!=0){ x ^= L; L += 1LL<