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 segments [*l*<sub class="lower-index">*i*</sub>, *r*<sub class="lower-index">*i*</sub>] on the *OX* axis. He can draw each segment with either red or blue. The drawing is good if and only if the following requirement is met: for each point *x* of the *OX* axis consider all the segments that contains point *x*; suppose, that *r*<sub class="lower-index">*x*</sub> red segments and *b*<sub class="lower-index">*x*</sub> blue segments contain point *x*; for each point *x* inequality |*r*<sub class="lower-index">*x*</sub> - *b*<sub class="lower-index">*x*</sub>| ≤ 1 must be satisfied.

A segment [*l*, *r*] contains a point *x* if and only if *l* ≤ *x* ≤ *r*.

Iahub gives you the starting and ending points of all the segments. You have to find any good drawing for him.
The first line of input contains integer *n* (1 ≤ *n* ≤ 10<sup class="upper-index">5</sup>) — the number of segments. The *i*-th of the next *n* lines contains two integers *l*<sub class="lower-index">*i*</sub> and *r*<sub class="lower-index">*i*</sub> (0 ≤ *l*<sub class="lower-index">*i*</sub> ≤ *r*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>) — the borders of the *i*-th segment.

It's guaranteed that all the segments are distinct.

import sys

def solve(pos):
    if(pos>=n):
        if check():
            colorsOk=colors.copy()
            return True
        return False
    colors[pos]=1
    if solve(pos+1):
        return True
    colors[pos]=-1
    if solve(pos+1):
        return True
    return False
    
def check():
    balance=[0]*(2*n)
   
    
    for i in range (n):
        left,right=segments[i]
        pointer=0
        while( left>endPoins[pointer]):
            pointer+=1
        while (pointer<balance.__len__() and right>=endPoins[pointer]):
            balance[pointer]+=colors[i] 
            pointer+=1
    for value in balance:
        if value>1 or value <-1:
            return False
    return True

n=int(input())
segments=[]
endPoins=[]*2*n
colors=[1]*n
colorsOk=[]

for i in range(n):
    left,right=map(int,sys.stdin.readline().split())
    segments.append([left,right])
    endPoins.append(left)
    endPoins.append(right)

endPoins=sorted(endPoins)
answ=''
if solve(0):
    for c in colors:
        if c==1:
            answ+=f'0 '
        else:
            answ+='1 '
print (answ)