/*****/ #include "bits/stdc++.h" //#include "atcoder/all" #define int long long //using namespace atcoder; using namespace std; typedef long long ll; typedef long double ld; typedef pair P; //typedef pair PP; typedef pair> PP; #define rep(i,a,b) for(int i=a;i=b;i--) #define all(x) (x).begin(),(x).end() const int MOD = 1e9 + 7; const int mod = 998244353; const double PI = 2 * acos(0.0); templatebool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; } templatebool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; } templatevoid vecout(vector array, char sep = '\n') {for(auto &v : array) {cout << v << sep;}} templateint vecsum(vector array) {int res = 0; for(auto &v : array) res += v; return res;} ll gcd(ll a, ll b) {return (a ? gcd(b%a, a) : b);}; ll lcm(ll a, ll b) {return (a*b / gcd(a,b));}; ll vecsum(vector array) {int res = 0; for(int v : array) res += v; return res;}; const ll infl = 1LL << 60; const int infi = 1 << 30; const vector

D = {{1,0}, {0,1}, {-1,0}, {0,-1}}; const vector di = {0, 1, 0, -1}; const vector dj = {1, 0, -1, 0}; //using mint = modint1000000007; //高速でnCkを求める // mint fac[2007], finv[2007], inv[2007]; // void init(){ // const int mMOD = mint::mod(); // fac[0] = fac[1] = 1; // finv[0] = finv[1] = 1; // inv[1] = 1; // for (int i = 2; i < 2007; i++){ // fac[i] = fac[i - 1] * i; // inv[i] = mMOD - inv[mMOD%i] * (mMOD / i); // finv[i] = finv[i - 1] * inv[i]; // } // } // mint nCk(int n, int k){ // if (n < k) return 0; // if (n < 0 || k < 0) return 0; // return fac[n] * finv[k] * finv[n - k]; // } // ////素因数分解をやるやつ // set prime_factors(int n) { // set factors; // while (n % 2 == 0) { // factors.insert(2); // n /= 2; // } // for (int i = 3; i <= std::sqrt(n); i += 2) { // while (n % i == 0) { // factors.insert(i); // n /= i; // } // } // if (n > 2) { // factors.insert(n); // } // return factors; // } /*****/ signed main() { int n,q; cin >> n >> q; vectora(n+2); rep(i,1,n+1) cin >> a[i]; a[0] = a[n+1] = 0; vector b(n+2,0); rep(_,0,q) { int l,r; cin >> l >> r; b[l]++; b[r+1]-=1; } rep(i,1,n+1) { b[i] += b[i-1]; if(b[i]%2!=0)a[i]^=1; cout << a[i] << " "; } cout << endl; return 0; }