#include using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); int n, q; cin >> n >> q; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } int imos[n + 1] = {}; for (int i = 0; i < q; i++) { int l, r; cin >> l >> r; imos[l - 1]++; imos[r]--; } for (int i = 1; i < n; i++) { imos[i] += imos[i - 1]; } for (int i = 0; i < n; i++) { cout << (a[i] + imos[i]) % 2 << " "; } cout << endl; }