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<iostream>
#include<cstdio>
#include<queue>
using namespace std;
#define x first
#define y second
int n,m,f[100001],fl[100001],fr[100001],gl[100001],gr[100001],ans[100001],l[100001],r[100001],fal[100001],far[100001];
pair<int,int> pl[100001],pr[100001];
priority_queue<pair<int,int> >qlx,qly;
priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > >qrx,qry;
bool fll[100001],flr[100001];
void down(int a,int b){
	if(a==0)return;
	if(b==0){
		ans[a]=1;
		down(a-1,fal[a]);
	}else{
		ans[a]=0;
		down(a-1,far[a]);
	}
}
int main(){
	scanf("%d%d",&n,&m);
	qlx.push(make_pair(0,0));
	qrx.push(make_pair(0,0));
	qly.push(make_pair(0,0));
	qry.push(make_pair(0,0));
	for(int i=1;i<=n;i++){
		scanf("%d%d%d%d%d",&f[i],&fl[i],&fr[i],&gl[i],&gr[i]);
		qlx.push(make_pair(f[i],i));
		qrx.push(make_pair(f[i],i));
		qly.push(make_pair(f[i],i));
		qry.push(make_pair(f[i],i));
		while(!qlx.empty()){
			pair<int,int> a=qlx.top();
			if(a.x>fr[i]){
				if(!l[a.y])l[a.y]=i;
				qlx.pop();
			}else break;
		}
		while(!qrx.empty()){
			pair<int,int> a=qrx.top();
			if(a.x<fl[i]){
				if(!l[a.y])l[a.y]=i;
				qrx.pop();
			}else break;
		}
		while(!qly.empty()){
			pair<int,int> a=qly.top();
			if(a.x>gr[i]){
				if(!r[a.y])r[a.y]=i;
				qly.pop();
			}else break;
		}
		while(!qry.empty()){
			pair<int,int> a=qry.top();
			if(a.x<gl[i]){
				if(!r[a.y])r[a.y]=i;
				qry.pop();
			}else break;
		}
	}
	while(!qlx.empty()){
		pair<int,int> a=qlx.top();
		if(!l[a.y])l[a.y]=n+1;
		qlx.pop();
	}
	while(!qrx.empty()){
		pair<int,int> a=qrx.top();
		if(!l[a.y])l[a.y]=n+1;
		qrx.pop();
	}
	while(!qly.empty()){
		pair<int,int> a=qly.top();
		if(!r[a.y])r[a.y]=n+1;
		qly.pop();
	}
	while(!qry.empty()){
		pair<int,int> a=qry.top();
		if(!r[a.y])r[a.y]=n+1;
		qry.pop();
	}
	pl[0].x=l[0];
	pl[0].y=r[0];
	pr[0].x=l[0];
	pr[0].y=r[0];
	fll[0]=1;
	flr[0]=1;
	for(int i=1;i<=n;i++){
		pl[i].y=r[i];
		pr[i].x=l[i];
		if(fll[i-1]){
			pl[i].x=max(pl[i].x,pl[i-1].x);
			pr[i].y=max(pr[i].y,pl[i-1].y);
		}
		if(flr[i-1]){
			pl[i].x=max(pl[i].x,pr[i-1].x);
			pr[i].y=max(pr[i].y,pr[i-1].y);
		}
		if(pl[i].x>i&&pl[i].y>i){
			fll[i]=1;
			if(pl[i].x==pl[i-1].x)fal[i]=0;
			else fal[i]=1;
		}else{
			pl[i].x=-1;
			pl[i].y=-1;
		}
		if(pr[i].x>i&&pr[i].y>i){
			flr[i]=1;
			if(pr[i].y==pl[i-1].y)far[i]=0;
			else far[i]=1;
		}else{
			pr[i].x=-1;
			pr[i].y=-1;
		}
		if(fll[i]==0&&flr[i]==0){
			printf("No\n");
			return 0;
		}
	}
	if(fll[n])down(n,0);
	else if(flr[n])down(n,1);
	printf("Yes\n");
	for(int i=1;i<=n;i++)printf("%d ",ans[i]);
}