Problem: The Alice's computer is broken, so she can't play her favorite card game now. To help Alice, Bob wants to answer n her questions. 

Initially, Bob holds one card with number 0 in the left hand and one in the right hand. In the i-th question, Alice asks Bob to replace a card in the left or right hand with a card with number k_i (Bob chooses which of two cards he changes, Bob must replace exactly one card).

After this action, Alice wants the numbers on the left and right cards to belong to given segments (segments for left and right cards can be different). Formally, let the number on the left card be x, and on the right card be y. Then after the i-th swap the following conditions must be satisfied: a_{l, i} ≤ x ≤ b_{l, i}, and a_{r, i} ≤ y ≤ b_{r,i}.

Please determine if Bob can answer all requests. If it is possible, find a way to do it.

Input

The first line contains two integers n and m (2 ≤ n ≤ 100 000, 2 ≤ m ≤ 10^9) — the number of questions and the maximum possible value on the card.

Then n queries are described. Every description contains 3 lines.

The first line of the description of the i-th query contains a single integer k_i (0 ≤ k_i ≤ m) — the number on a new card.

The second line of the description of the i-th query contains two integers a_{l, i} and b_{l, i} (0 ≤ a_{l, i} ≤ b_{l, i} ≤ m) — the minimum and maximum values of the card at the left hand after the replacement.

The third line of the description of the i-th query contains two integers a_{r, i} and b_{r,i} (0 ≤ a_{r, i} ≤ b_{r,i} ≤ m) — the minimum and maximum values of the card at the right hand after the replacement.

Output

At the first line, print "Yes", if Bob can answer all queries, and "No" otherwise.

If Bob can answer all n queries, then at the second line print n numbers: a way to satisfy all requirements. If in i-th query Bob needs to replace the card in the left hand, print 0, otherwise print 1. If there are multiple answers, print any.

Examples

Input


2 10
3
0 3
0 2
2
0 4
0 2


Output


Yes
0 1 

Input


2 10
3
0 3
0 2
2
3 4
0 1


Output


No

Input


5 10
3
0 3
0 3
7
4 7
1 3
2
2 3
3 7
8
1 8
1 8
6
1 6
7 10


Output


Yes
1 0 0 1 0 

Solution (in CPP):

Solution:
#include <cstdio>
#define maxn 100005
int n, m;

struct SegMentTree {
	struct node {
		int l, r, tag, id, s;
	}t[maxn * 30];
	int cnt = 0, root;
	
	#define lson t[now].l
	#define rson t[now].r
	
	void pushdown( int now ) {
		if( t[now].tag ) {
			t[lson].s = t[rson].s = 0;
			t[lson].tag = t[rson].tag = t[now].tag;
			t[now].tag = 0;
		}	
	}
	
	void clear( int now, int l, int r, int L, int R ) {
		if( r < L || R < l ) return;
		if( ! now ) return;
		if( L <= l && r <= R ) {
			t[now].s = 0;
			t[now].tag = 1;
			return;
		}
		pushdown( now );
		int mid = ( l + r ) >> 1;
		clear( lson, l, mid, L, R );
		clear( rson, mid + 1, r, L, R );
		t[now].s = t[lson].s | t[rson].s;
	}
	
	void insert( int &now, int l, int r, int pos, int id ) {
		if( ! now ) now = ++ cnt;
		if( l == r ) {
			t[now].s = 1;
			t[now].id = id;
			return;
		}
		pushdown( now );
		int mid = ( l + r ) >> 1;
		if( pos <= mid ) insert( lson, l, mid, pos, id );
		else insert( rson, mid + 1, r, pos, id );
		t[now].s = t[lson].s | t[rson].s;
	}
	
	int query( int now = 1, int l = 0, int r = m ) {
		if( l == r ) return t[now].id;
		pushdown( now );
		int mid = ( l + r ) >> 1;
		if( t[lson].s ) return query( lson, l, mid );
		else return query( rson, mid + 1, r );
	}
	
	bool check() { return t[1].s; }
	
}L, R;

struct read {
	int x, L_rangel, L_ranger, R_rangel, R_ranger;
	read(){}
	read( int X, int AL, int AR, int BL, int BR ) {
		x = X, L_rangel = AL, L_ranger = AR, R_rangel = BL, R_ranger = BR;
	}
}MS[maxn];

int ansl[maxn], ansr[maxn], ans[maxn];
bool ChooseL[maxn], ChooseR[maxn];

int main() {
	scanf( "%d %d", &n, &m );
	L.insert( L.root, 0, m, 0, 0 );
	R.insert( R.root, 0, m, 0, 0 );
	for( int i = 1, x, L_rangel, L_ranger, R_rangel, R_ranger;i <= n;i ++ ) {
		scanf( "%d %d %d %d %d", &x, &L_rangel, &L_ranger, &R_rangel, &R_ranger );
		MS[i] = read( x, L_rangel, L_ranger, R_rangel, R_ranger );
		bool l_ok = L.check(), r_ok = R.check();
		if( l_ok ) ansl[i] = L.query();
		else ansl[i] = -1;
		if( r_ok ) ansr[i] = R.query();
		else ansr[i] = -1;
		if( L_rangel <= x && x <= L_ranger ) {
		//x is included in L->[l,r] which is suitable for request of option 0
			R.clear( R.root, 0, m, 0, R_rangel - 1 );
			R.clear( R.root, 0, m, R_ranger + 1, m );
			if( i > 1 && R_rangel <= MS[i - 1].x && MS[i - 1].x <= R_ranger && l_ok )
				R.insert( R.root, 0, m, MS[i - 1].x, i - 1 ), ChooseR[i] = 1;
			//however we must also sure that the number we keep on right hand is also included in R->[l,r] 
			//only both are acceptable can we do option 0 truly
		}
		else R.clear( R.root, 0, m, 0, m );//otherwise the whole array of L should be cleared
		if( R_rangel <= x && x <= R_ranger ) {
			L.clear( L.root, 0, m, 0, L_rangel - 1 );
			L.clear( L.root, 0, m, L_ranger + 1, m );
			if( i > 1 && L_rangel <= MS[i - 1].x && MS[i - 1].x <= L_ranger && r_ok )
				L.insert( L.root, 0, m, MS[i - 1].x, i - 1 ), ChooseL[i] = 1;
		}
		else L.clear( L.root, 0, m, 0, m );
	}
	if( L.check() || R.check() ) {//backward print(END -> BEGIN)
		printf( "Yes\n" );
		int pos = n, lim, f;
		if( L.check() ) lim = L.query(), f = 0;
		else lim = R.query(), f = 1;
		while( pos ) {
			if( f ) {//this option choose 0(replace left)
				ans[pos] = 0;
				if( pos > lim + 1 ) goto out;
				else f ^= 1, lim = ansl[pos];
			}
			else {//this option choose 1(replace right)
				ans[pos] = 1;
				if( pos > lim + 1 ) goto out;
				else f ^= 1, lim = ansr[pos];
			}
			out : pos --;
		}
		for( int i = 1;i <= n;i ++ )
			printf( "%d ", ans[i] );
	}
	else printf( "No\n" );
	return 0;
}