// 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;
}