n, q = map(int, input().split()) a = list(map(int, input().split())) b = [0] * n for _ in range(q): l, r = map(int, input().split()) l -= 1 b[l] ^= 1 if r < n: b[r] ^= 1 for i in range(1, n): b[i] ^= b[i - 1] for i in range(n): a[i] ^= b[i] print(*a)