#include using namespace std; int N, Q; int A[500009]; int L[500009], R[500009]; int S[500009]; int main() { cin >> N >> Q; for (int i = 1; i <= N; i++) cin >> A[i]; for (int i = 1; i <= Q; i++) cin >> L[i] >> R[i]; for (int i = 1; i <= Q; i++) { S[L[i]]++; S[R[i] + 1]--; } for (int i = 1; i <= N; i++) { S[i] = S[i - 1] + S[i]; } for (int i = 1; i <= N; i++) { cout << (A[i] + S[i]) % 2; if (i == N) cout << endl; else cout << ' '; } return 0; }