N, Q = map(int, input().split()) assert(1 <= N <= 500000 and 1 <= Q <= 500000) A = list(map(int, input().split())) c = [0] * (N + 1) # xor版いもす法 for _ in range(Q): L, R = map(int, input().split()) assert(1 <= L <= R <= N) c[L - 1] ^= 1 c[R] ^= 1 for i in range(N): c[i + 1] ^= c[i] print(*[c[i] ^ A[i] for i in range(N)]) try: input() assert(False) except: pass