#ifdef NACHIA #define _GLIBCXX_DEBUG #else #define NDEBUG #endif #include #include #include #include using i64 = long long; using u64 = unsigned long long; #define rep(i,n) for(int i=0; i void chmin(A& l, const A& r){ if(r < l) l = r; } template void chmax(A& l, const A& r){ if(l < r) l = r; } using namespace std; void testcase(){ int N, Q; cin >> N >> Q; vector A(N+1); rep(i,N) cin >> A[i]; for(int i=N-1; i>=0; i--) A[i+1] ^= A[i]; rep(i,Q){ int l,r; cin >> l >> r; l--; A[l] ^= 1; A[r] ^= 1; } rep(i,N) A[i+1] ^= A[i]; rep(i,N){ if(i) cout << " "; cout << A[i]; } cout << "\n"; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); testcase(); return 0; }