local n, q = io.read("*n", "*n") local a = {} local f = {} for i = 1, n do a[i] = io.read("*n") f[i] = 0 end for i = 1, q do local l, r = io.read("*n", "*n") f[l] = 1 - f[l] if r < n then f[r + 1] = 1 - f[r + 1] end end local z = 0 for i = 1, n do if f[i] == 1 then z = 1 - z end if z == 1 then a[i] = 1 - a[i] end end print(table.concat(a, " "))