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 <bits/stdc++.h>
using namespace std;

# define Rep(i,a,b) for(int i=a;i<=b;i++)
# define _Rep(i,a,b) for(int i=a;i>=b;i--)
# define RepG(i,u) for(int i=head[u];~i;i=e[i].next)

typedef long long ll;

const int N=1e5+5;

template<typename T> void read(T &x){
   x=0;int f=1;
   char c=getchar();
   for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
   for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+c-'0';
    x*=f;
}

int n,m;
int a[N];
int l[N][2],r[N][2];
int sum[N][2];
bool f[N][2];
int g[N][2];
int ans[N];

int main()
{
	read(n),read(m);
	Rep(i,1,n){
		read(a[i]);
		read(l[i][0]),read(r[i][0]);
		read(l[i][1]),read(r[i][1]);
	}
	Rep(i,1,n)
		Rep(op,0,1)
			sum[i][op]=sum[i-1][op]+(a[i]>=l[i][op]&&a[i]<=r[i][op]);
	int j1=n,j2=n;
	int maxl[2],minr[2];
	maxl[0]=l[n][0],maxl[1]=l[n][1];
	minr[0]=r[n][0],minr[1]=r[n][1];
	_Rep(i,n-1,0){
		Rep(op,0,1){
			maxl[op]=max(maxl[op],l[i][op]);
			minr[op]=min(minr[op],r[i][op]);	
		}
		f[i][0]=(a[i]>=maxl[0]&&a[i]<=minr[0])&&(sum[j2][1]-sum[i][1]==j2-i);
		f[i][1]=(a[i]>=maxl[1]&&a[i]<=minr[1])&&(sum[j1][0]-sum[i][0]==j1-i);
//		printf("!!!%d %d\n",maxl[1],minr[1]);
		int tmp1=j1,tmp2=j2;
		if(f[i][0])g[i][0]=tmp2,j1=i,maxl[1]=l[i][1],minr[1]=r[i][1];
		if(f[i][1])g[i][1]=tmp1,j2=i,maxl[0]=l[i][0],minr[0]=r[i][0];
//		printf("???%d %d\n",maxl[1],minr[1]);
	}
//	Rep(i,0,n)printf("%d ",g[i][0]);
//	puts("");
//	Rep(i,0,n)printf("%d ",g[i][1]);
//	puts("");
	int now=0,op;
	if(!f[0][0]&&!f[0][1])return puts("No"),0;
	puts("Yes");
	if(f[n][0])op=0;
	else op=1;
	while(now<n){
		Rep(i,now+1,g[now][op])ans[i]=op^1;
		now=g[now][op],op^=1;
	}
	Rep(i,1,n)printf("%d ",ans[i]);
	puts("");
	return 0;
}