N,Q = map(int,input().split()) A = list(map(int,input().split())) S = [0]*(N+1) for i in range(Q): l, r = map(int,input().split()) l -= 1 r -= 1 S[l] += 1 S[r+1] -= 1 for i in range(1,N+1): S[i] += S[i-1] ans = [None]*N for i in range(N): ans[i] = (A[i] + S[i]) % 2 print(*ans)