#include int main() { int n, q; scanf("%d%d", &n, &q); int a[n]; for (int i = 0; i < n; ++i) scanf("%d", &a[i]); int b[n]; for (int i = 0; i < n; ++i) b[i] = 0; for (int i = 0; i < q; ++i) { int l, r; scanf("%d%d", &l, &r); l--; b[l] ^= 1; if (r < n) b[r] ^= 1; } for (int i = 1; i < n; ++i) b[i] ^= b[i - 1]; for (int i = 0; i < n; ++i) { a[i] ^= b[i]; if (i == 0) printf("%d", a[i]); else printf(" %d", a[i]); } printf("\n"); return 0; }