#include #include using namespace std; int main(){ int n;cin>>n; vector A(n); int nw = 0; for(int i = 0; n > i; i++){ cin>>A[i]; nw ^= A[i]; } if(nw != 0){ cout << 1 << endl; for(int i = 0; n > i; i++){ if(A[i] >= nw){ cout << i+1 << " " << nw << endl; A[i] -= nw; break; } } int ret;cin>>ret; if(ret == -1)return 0; }else{ cout << 0 << endl; } while(true){ int i,k;cin>>i>>k; A[i-1] -= k; int ret;cin>>ret; if(ret == -1)return 0; for(int j = 0; n > j; j++){ if(A[j] >= nw && (A[j]^(A[j]-k)) == k){ cout << j+1 << " " << k << endl; A[j] -= nw; break; } } cin>>ret; if(ret == -1)return 0; } }