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 MAXN 200005
#define lowbit(x) (x&-x)
#define reg register
#define mkpr make_pair
typedef long long LL;
typedef unsigned long long uLL;
const int INF=0x3f3f3f3f;
const int mo=1e9+7;
const int iv2=5e8+4;
const int lim=1000000;
const int jzm=2333;
const int orG=3,invG=332748118;
const double Pi=acos(-1.0);
typedef pair<int,int> pii;
template<typename _T>
_T Fabs(_T x){return x<0?-x:x;}
template<typename _T>
void read(_T &x){
	_T f=1;x=0;char s=getchar();
	while(s>'9'||s<'0'){if(s=='-')f=-1;s=getchar();}
	while('0'<=s&&s<='9'){x=(x<<3)+(x<<1)+(s^48);s=getchar();}
	x*=f;
}
template<typename _T>
void print(_T x){if(x<0){x=(~x)+1;putchar('-');}if(x>9)print(x/10);putchar(x%10+'0');}
int gcd(int a,int b){return !b?a:gcd(b,a%b);}
int add(int x,int y){return x+y<mo?x+y:x+y-mo;}
int n,m,ansl[MAXN],ansr[MAXN],ans[MAXN];
bool choL[MAXN],choR[MAXN];
struct ming{int k,al,bl,ar,br;}s[MAXN];
class SegmentTree{
	public:
		bool lzy[MAXN*30],tr[MAXN*30];int tot,root,ch[MAXN*30][2],tim[MAXN*30];
		void pushdown(int rt){
			if(lzy[rt]){
				if(ch[rt][0])tr[ch[rt][0]]=0,lzy[ch[rt][0]]=1;
				if(ch[rt][1])tr[ch[rt][1]]=0,lzy[ch[rt][1]]=1;
				lzy[rt]=0;
			}
		}
		void pushup(int rt){tr[rt]=tr[ch[rt][0]]|tr[ch[rt][1]];}
		void insert(int &rt,int l,int r,int ai,int aw){
			if(l>ai||r<ai||l>r)return ;if(!rt)rt=++tot;
			if(l==r){tr[rt]=1;tim[rt]=aw;return ;}int mid=l+r>>1;pushdown(rt);
			if(ai<=mid)insert(ch[rt][0],l,mid,ai,aw);
			if(ai>mid)insert(ch[rt][1],mid+1,r,ai,aw);
			pushup(rt);
		}
		void modify(int rt,int l,int r,int al,int ar){
			//printf("modify %d %d %d %d\n",l,r,al,ar);
			if(l>r||l>ar||r<al||al>ar||!rt)return ;int mid=l+r>>1;
			if(al<=l&&r<=ar){tr[rt]=0;lzy[rt]=1;return ;}pushdown(rt);
			if(al<=mid)modify(ch[rt][0],l,mid,al,ar);
			if(ar>mid)modify(ch[rt][1],mid+1,r,al,ar);
			pushup(rt);
		}
		bool query(int rt){return tr[rt];}
		int sakura(int rt,int l,int r){
			//printf("sakura %d %d:%d\n",l,r,tr[rt]);
			if(l==r)return tim[rt];int mid=l+r>>1;pushdown(rt);
			if(tr[ch[rt][0]])return sakura(ch[rt][0],l,mid);
			return sakura(ch[rt][1],mid+1,r);
		}
}TL,TR;
signed main(){
	read(n);read(m);TL.insert(TL.root,0,m,0,0);TR.insert(TR.root,0,m,0,0);
	for(int i=1;i<=n;i++){
		read(s[i].k);read(s[i].al);read(s[i].bl);read(s[i].ar);read(s[i].br);
		bool Llive=TL.query(TL.root),Rlive=TR.query(TR.root);
		if(Llive)ansl[i]=TL.sakura(TL.root,0,m);else ansl[i]=-1;
		if(Rlive)ansr[i]=TR.sakura(TR.root,0,m);else ansr[i]=-1;
		//puts("Ltree");
		if(s[i].ar<=s[i].k&&s[i].k<=s[i].br){
			TL.modify(TL.root,0,m,0,s[i].al-1),TL.modify(TL.root,0,m,s[i].bl+1,m);
			if(i>1&&s[i].al<=s[i-1].k&&s[i-1].k<=s[i].bl&&Rlive)
				TL.insert(TL.root,0,m,s[i-1].k,i-1),choL[i]=1;
		}
		else TL.modify(TL.root,0,m,0,m);
		//puts("Rtree");
		if(s[i].al<=s[i].k&&s[i].k<=s[i].bl){
			TR.modify(TR.root,0,m,0,s[i].ar-1),TR.modify(TR.root,0,m,s[i].br+1,m);
			if(i>1&&s[i].ar<=s[i-1].k&&s[i-1].k<=s[i].br&&Llive)
				TR.insert(TR.root,0,m,s[i-1].k,i-1),choR[i]=1;
		}
		else TR.modify(TR.root,0,m,0,m);
		//printf("%d:%d %d\n",i,ansl[i],ansr[i]);
	} 
	if(TL.query(TL.root)||TR.query(TR.root)){
		puts("Yes");int x=0,y=0;int tot=n,lim;bool f;
		if(TL.query(TL.root))lim=TL.sakura(TL.root,0,m),x=s[lim].k,y=s[n].k,f=0;
		else lim=TR.sakura(TR.root,0,m),x=s[n].k,y=s[lim].k,f=1;
		while(tot){
			//if(s[tot].al>x||x>s[tot].bl)while(1);
			//if(s[tot].ar>y||y>s[tot].br)while(1);
			//printf("%d %d\n",x,y);
			int tmpl=(y!=s[tot-1].k||!choR[tot])?s[tot-1].k:ansl[tot];
			if(f){ans[tot]=0;if(tot>lim+1)x=s[tot-1].k;else f^=1,x=s[lim=ansl[tot]].k;}
			else{ans[tot]=1;if(tot>lim+1)y=s[tot-1].k;else f^=1,y=s[lim=ansr[tot]].k;}
			tot--;
		}
		for(int i=1;i<=n;i++)printf("%d ",ans[i]);puts("");
	}
	else puts("No");
	return 0;
}
/*
L[i]
if(i<k-1)
R[j]
*/