#include using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; template using V=vector; template using VV=V>; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n,q; cin>>n>>q; V A(n); rep(i,n) cin>>A[i]; V B(n+1); rep(i,q){ int l,r; cin>>l>>r; l--; B[l]++; B[r]++; } for(int i=1;i<=n;i++) B[i]=(B[i]+B[i-1])%2; rep(i,n) A[i]=(A[i]+B[i])%2; rep(i,n){ if(i) cout<<" "; cout<