#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]
*/