#include using namespace std; int main() { int N, Q; cin >> N >> Q; vector A(N); for (int i = 0; i < N; i++) cin >> A[i]; vector B(N+1, 0); for (int i = 0; i < Q; i++) { int l, r; cin >> l >> r; B[l-1]^=1; B[r]^=1; } for (int i = 1; i <= N; i++) B[i]^=B[i-1]; for (int i = 0; i < N; i++) A[i]^=B[i]; for (int i = 0; i < N; i++) cout << A[i] << " "; cout << endl; }