Solve each query in Q
for ( let i = 0 ; i < q . length ; i ++ ) { let id = q [ i ] [ 0 ] ; if ( id == 1 ) { let L = q [ i ] [ 1 ] ; let R = q [ i ] [ 2 ] ; document . write ( " " + " " + rangeXor ( BITree , L , R ) + " " ) ; } else { let idx = q [ i ] [ 1 ] ; let val = q [ i ] [ 2 ] ; A [ idx ] ^= val ;