using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (n, q) = (c[0], c[1]); var a = NList; var map = NArr(q); var rev = new int[n + 1]; foreach (var flip in map) { ++rev[flip[0] - 1]; ++rev[flip[1]]; } for (var i = 0; i < n; ++i) { if (i > 0) rev[i] += rev[i - 1]; if (rev[i] % 2 == 1) a[i] = 1 - a[i]; } WriteLine(string.Join(" ", a)); } }