def Input(): S = input() if S[0] == ' ' or S[-1] == ' ': assert(False) return S 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