Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.

Iahub wants to draw n distinct points and m segments on the OX axis. He can draw each point with either red or blue. The drawing is good if and only if the following requirement is met: for each segment [li, ri] consider all the red points belong to it (ri points), and all the blue points belong to it (bi points); each segment i should satisfy the inequality |ri - bi| ≤ 1.

Iahub thinks that point x belongs to segment [l, r], if inequality l ≤ x ≤ r holds.

Iahub gives to you all coordinates of points and segments. Please, help him to find any good drawing.

Input

The first line of input contains two integers: n (1 ≤ n ≤ 100) and m (1 ≤ m ≤ 100). The next line contains n space-separated integers x1, x2, ..., xn (0 ≤ xi ≤ 100) — the coordinates of the points. The following m lines contain the descriptions of the m segments. Each line contains two integers li and ri (0 ≤ li ≤ ri ≤ 100) — the borders of the i-th segment.

It's guaranteed that all the points are distinct.

Output

If there is no good drawing for a given test, output a single integer -1. Otherwise output n integers, each integer must be 0 or 1. The i-th number denotes the color of the i-th point (0 is red, and 1 is blue).

If there are multiple good drawings you can output any of them.

Examples

Input

3 3
3 7 14
1 5
6 10
11 15


Output

0 0 0

Input

3 4
1 2 3
1 2
2 3
5 6
2 2


Output

1 0 1

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Sorting

Constructive algorithms


Solutions:
(n, m) = map(int, input().split())
t = list(enumerate(list(map(int, input().split()))))
t.sort(key=lambda x: x[1])
p = ['0'] * n
for (i, x) in t[::2]:
	p[i] = '1'
print(' '.join(p))


(n, m) = map(int, input().split())
c = list(map(int, input().split()))
cc = c.copy()
d = []
for i in range(m):
	input()
output = []
cc.sort()
for i in c:
	index = cc.index(i)
	if index % 2 == 0:
		output.append('0')
	else:
		output.append('1')
print(' '.join(output))


(n, m) = list(map(int, input().split()))
points = [(v, i) for (i, v) in enumerate(map(int, input().split()))]
for _ in range(m):
	input()
blue = True
ans = [0] * n
points = sorted(points)
for p in points:
	(v, i) = p
	ans[i] = int(blue)
	blue = not blue
for v in ans:
	print(v, end=' ')
print()


(n, m) = map(int, input().split())
X = [int(x) for x in input().split()]
segs = [[int(x) for x in input().split()] for _ in range(m)]
D = {e: i % 2 for (i, e) in enumerate(sorted(X))}
for i in range(n):
	X[i] = D[X[i]]
print(*X)


import sys
read = lambda t=int: list(map(t, sys.stdin.readline().split()))
(_, M) = read()
xs = read()
for _ in range(M):
	_ = read()
xs = sorted(((x, i) for (i, x) in enumerate(xs)))
xs = sorted(((i, j) for (j, (x, i)) in enumerate(xs)))
print(' '.join((str(j % 2) for (_, j) in xs)))


(n, m) = map(int, input().split())
a = [int(i) for i in input().split()]
b = sorted([[a[i], i] for i in range(n)])
for i in range(m):
	(l, r) = map(int, input().split())
for i in range(n):
	a[b[i][1]] = str(i % 2)
print(' '.join(a))


(a, b) = map(int, input().split(' '))
pts = list(map(int, input().split(' ')))
pts2 = [[pts[i], i, 0] for i in range(len(pts))]
pts2.sort()
for i in range(1, a, 2):
	pts2[i][2] = 1
pts2.sort(key=lambda x: x[1])
string = ''
for i in pts2:
	string += str(i[2])
	string += ' '
print(string.strip())


(n, m) = map(int, input().split())
points = list(zip(map(int, input().split()), range(n)))
points.sort()
res = []
curr = 0
for point in points:
	res.append((point[1], (curr + 1) % 2))
	curr += 1
res.sort()
for point in res:
	print(point[1], end=' ')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in range(n):
	b.append((a[i], i))
b.sort()
for i in range(n):
	b[i] = (b[i][0], b[i][1], i % 2)
c = []
for i in b:
	c.append((i[1], i[0], i[2]))
c.sort()
for i in c:
	print(i[2], end=' ')


input()
P = list(map(int, input().split()))
l = sorted([[P.index(p), i % 2] for (i, p) in enumerate(sorted(P))])
for (a, b) in l:
	print(b)


(n, m) = map(int, input().split())
xlist = [int(x) for x in input().split()]
plist = xlist[:]
xlist.sort()
for i in range(n):
	if xlist.index(plist[i]) % 2 == 0:
		plist[i] = '0'
	else:
		plist[i] = '1'
print(''.join([plist[i] + ' ' for i in range(n)]))


(n, m) = map(int, input().split())
L = list(map(int, input().split()))
for i in range(n):
	L[i] = (L[i], i)
L.sort()
Ans = [0] * n
for i in range(n):
	Ans[L[i][1]] = i % 2
for i in range(n):
	print(Ans[i], end=' ')


R = lambda : list(map(int, input().split()))
(n, m) = R()
a = R()
exist = [False for i in range(200)]
for i in range(m):
	(l, r) = R()
	for j in a:
		if l <= j <= r:
			exist[j] = True
b = a[:]
b.sort()
ans = [0 for i in range(200)]
flag = 0
for i in b:
	if exist[i]:
		ans[i] = flag
		flag ^= 1
for i in a:
	print(ans[i], end=' ')


(n, m) = [int(i) for i in input().split()]
p = list(map(int, input().split()))
s = [input().split() for _ in range(m)]
(ps, result) = (sorted(p), [-1] * n)
for i in range(n):
	if i % 2 == 0:
		c = 1
	else:
		c = 0
	result[p.index(ps[i])] = c
print(*result)


import operator
input()
l = [[p, i, 0] for (i, p) in enumerate(map(int, input().split()))]
l.sort()
t = 0
for i in range(len(l)):
	l[i][2] = t % 2
	t += 1
l.sort(key=operator.itemgetter(1))
print(' '.join([str(ll[2]) for ll in l]))


import operator as a
input()
l = sorted([[p, i, 0] for (i, p) in enumerate(map(int, input().split()))])
for i in range(len(l)):
	l[i][2] = i % 2
for (a, b, c) in sorted(l, key=a.itemgetter(1)):
	print(c, ' ')


(n, m) = map(int, input().split())
points = list(map(int, input().split()))
segments = [input().split() for _ in range(m)]
sorted_points = sorted(points)
ans = [-1] * n
for i in range(n):
	c = '0' if i % 2 else '1'
	ans[points.index(sorted_points[i])] = c
print(' '.join(ans))


(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
for i in range(n):
	arr[i] = (arr[i], i)
arr.sort()
res = [0] * n
for i in range(n):
	res[arr[i][1]] = i % 2
print(*res)


(n, m) = map(int, input().split())
p = sorted(((x[1], x[0]) for x in enumerate(map(int, input().split()))))
p = sorted(((x[1], str(i % 2)) for (i, x) in enumerate(p)))
print(' '.join((x[1] for x in p)))


(n, m) = map(int, input().split())
xs = list(map(int, input().split()))
ys = sorted(range(n), key=xs.__getitem__)
zs = sorted(((ys[i], i % 2) for i in range(n)))
print(*(z[1] for z in zs))


import sys
import math
import random
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = sorted(a)
for i in range(len(a)):
	for j in range(len(b)):
		if a[i] == b[j]:
			if j % 2 == 0:
				print('1 ', end='')
			else:
				print('0 ', end='')


from sys import stdin, stdout
nmbr = lambda : int(stdin.readline())
lst = lambda : list(map(int, stdin.readline().split()))
for _ in range(1):
	(n, k) = lst()
	mp = {}
	a = lst()
	for i in range(n):
		mp[a[i]] = i
	b = sorted(a)
	turn = 0
	ans = [0] * n
	for v in b:
		ans[mp[v]] = turn & 1
		turn += 1
	print(*ans)


from operator import *
R = lambda : map(int, input().split())
(n, m) = R()
x = sorted(enumerate(R()), key=itemgetter(1))
y = [0] * n
for i in range(n):
	y[x[i][0]] = i % 2
print(' '.join(map(str, y)))