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:
// Problem: E. Game with Cards
// Contest: Codeforces - Codeforces Round #727 (Div. 2)
// URL: https://codeforces.com/contest/1539/problem/E
// Memory Limit: 256 MB
// Time Limit: 2500 ms
// 
// Powered by CP Editor (https://cpeditor.org)
 
//And in that light,I find deliverance.
#include<bits/stdc++.h>
using namespace std;
inline int read(){
   int s=0,w=1;
   char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
int n;
int a[100003];
struct stmin
{
	int a[100003],st[100003][21],l2[100003];
	inline void init(int l)
	{
		st[l][0]=a[l];
		for(int i=1; i<=20; i++) 
		st[l][i]=max(st[l][i-1],st[min(l+(1<<(i-1)),n)][i-1]);
	}
	inline int query(int l,int r)
	{
		int L=l2[r-l+1];
		return max(st[l][L],st[min(r-(1<<L)+1,n)][L]);
	}
	void main()
	{
	    for(int i=2; i<=n; i++) l2[i]=l2[i>>1]+1;
		for(int i=n; i; --i) init(i);
		return ;
	}
}l0,r0;
struct stmax
{
	int a[100003],st[100003][21],l2[100003];
	inline void init(int l)
	{
		st[l][0]=a[l];
		for(int i=1; i<=20; i++) 
		st[l][i]=min(st[l][i-1],st[min(l+(1<<(i-1)),n)][i-1]);
	}
	inline int query(int l,int r)
	{
		int L=l2[r-l+1];
		return min(st[l][L],st[min(r-(1<<L)+1,n)][L]);
	}
	void main()
	{
	    for(int i=2; i<=n; i++) l2[i]=l2[i>>1]+1;
		for(int i=n; i; --i) init(i);
		return ;
	}
}l1,r1;
int dl[1000003],dr[1000003];
int fl[1000003],fr[1000003];
bool checkl(int l,int r)
{
	return l0.query(l,r)<=a[l]&&a[l]<=l1.query(l,r);
}
bool checkr(int l,int r)
{
	return r0.query(l,r)<=a[l]&&a[l]<=r1.query(l,r);
}
int ans[1000003];
void dfs(int i,int t)
{
	if(i==1) return ;
	ans[i]=t;
	if(t==0)
	{
		int A=0,B=0;
		if(fl[i-1]>=i) A=fl[i-1];
		if(fr[i-1]>=i-1&&dr[i-1]>=i) 
		B=dr[i-1];
		if(A>=B) dfs(i-1,0);
		else dfs(i-1,1);
	}
	else
	{	
		int A=0,B=0;
		if(fr[i-1]>=i) A=fr[i-1];
		if(fl[i-1]>=i-1&&dl[i-1]>=i) 
		B=dl[i-1];
		if(A>=B) dfs(i-1,1);
		else dfs(i-1,0);
	}
	return ;
}
signed main()
{
	n=read()+1;read();
	for(int i=2; i<=n; ++i) 
	{
		a[i]=read();
		l0.a[i]=read(),l1.a[i]=read();
		r0.a[i]=read(),r1.a[i]=read();
	}
	l0.main(),l1.main();
	r0.main(),r1.main();
	for(int i=1; i<=n; ++i)
	{
		int l=i,r=n,res=-1;
		while(l<=r)
		{
			int mid=(l+r)>>1;
			if(checkl(i,mid)) res=mid,l=mid+1;
			else r=mid-1;
		}
		dl[i]=res;
	}
	for(int i=1; i<=n; ++i)
	{
		int l=i,r=n,res=-1;
		while(l<=r)
		{
			int mid=(l+r)>>1;
			if(checkr(i,mid)) res=mid,l=mid+1;
			else r=mid-1;
		}
		dr[i]=res;
	}
	//for(int i=1; i<=n; ++i) printf("%d %d\n",dl[i],dr[i]);
	fl[1]=dr[1],fr[1]=dl[1];
	for(int i=2; i<=n; ++i)
	{
		fl[i]=fr[i]=-1;
		if(dl[i]!=-1)
		{
			int X=-1;
			if(fl[i-1]>=i)  X=max(X,fl[i-1]);
			if(fr[i-1]>=i-1&&dr[i-1]>=i) 
			X=max(X,dr[i-1]);
			fl[i]=X;
		}
		//fl
		if(dr[i]!=-1)
		{
			int X=-1;
			if(fr[i-1]>=i)  X=max(X,fr[i-1]);
			if(fl[i-1]>=i-1&&dl[i-1]>=i) 
			X=max(X,dl[i-1]);
			fr[i]=X;
		}
		//fr
	}
	if(fl[n]==n||fr[n]==n) 
	{
		puts("Yes");
		if(fl[n]==n) dfs(n,0);
		else dfs(n,1);
		for(int i=2; i<=n; ++i) printf("%d ",ans[i]);
		puts("");
		int L=0,R=0;
		for(int i=2; i<=n; ++i)
		{	
			if(ans[i]) R=a[i]; else L=a[i];
			#ifdef local
			assert(l0.a[i]<=L&&L<=l1.a[i]);
			assert(r0.a[i]<=R&&R<=r1.a[i]);
			printf("Test %d passed\n",i-1);
			#endif
		}
	}
	else
	{
		puts("No");
	}
	return 0;
}