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<cstdio>
#include<cctype>
#include<cstring>

#define mod 998244353

template<class T>

inline T read(){
    T r=0,f=0;
    char c;
    while(!isdigit(c=getchar()))f|=(c=='-');
    while(isdigit(c))r=(r<<1)+(r<<3)+(c^48),c=getchar();
    return f?-r:r;
}

template<class T>

inline T min(T a,T b){
	return a<b?a:b;
}

template<class T>

inline T max(T a,T b){
	return a>b?a:b;
}

template<class T>

inline void swap(T &a,T &b){
	T c=a;
	a=b;
	b=c;
}

#define ll long long

inline ll gcd(ll a,ll b){
	return b?gcd(b,a%b):a;
}

inline ll qpow(ll a,int b){
	ll ans=1;
	for(;b;b>>=1){
		if(b&1)(ans*=a)%=mod;
		(a*=a)%=mod;
	}
	return ans;
}

#undef ll

struct Z{

#define add(x) (x>=mod?x-mod:x)
#define sub(x) (x<0?x+mod:x)

	int x;
	inline int val() const{
		return x;
	}
	inline int inv() const{
		return qpow(x,mod-2);
	}

	Z(int x=0):x(x) {}
	Z operator -() const{
		return Z(add(mod-x));
	}
	Z &operator +=(const Z &z){
		x=add(x+z.x);
		return *this;
	}
	Z &operator -=(const Z &z){
		x=sub(x-z.x);
		return *this;
	}
	Z &operator *=(const Z &z){
		x=1ll*x*z.x%mod;
		return *this;
	}
	Z &operator /=(const Z &z){
		x=1ll*x*z.inv()%mod;
		return *this;
	}
	Z operator +(const Z &z) const{
		return Z(add(x+z.x));
	}
	Z operator -(const Z &z) const{
		return Z(sub(x-z.x));
	}
	Z operator *(const Z &z) const{
		return Z(1ll*x*z.x%mod);
	}
	Z operator /(const Z &z) const{
		return Z(1ll*x*z.inv()%mod);
	}

#undef add
#undef sub

};

#define maxn 101101

int n,m,val[maxn],L[2][maxn],R[2][maxn];

int can[2][2][maxn];

int r[2];

struct LR{
	int l,r;
	LR(int l=-1,int r=-1){this->l=l;this->r=r;}
	LR operator + (const LR &b) const{
		LR c;
		c.l=max(l,b.l);
		c.r=min(r,b.r);
		return c;
	}
	inline bool in(int x){
		return l<=x&&x<=r;
	}
}lr[2][22][maxn];

int er[22];

struct F{
	bool f;
	int pre;
	F() {}
	F(bool f,int pre):f(f),pre(pre) {}
	F operator +(const F &b) const{
		F c;
		c.f=f&b.f;
		c.pre=pre;
		return c;
	}
};

struct S_T{

#define ls (p<<1)
#define rs ((p<<1)|1)

	F And[maxn<<2];

    void change(int p,int l,int r,int L,int R,int pre){
		if(And[p].f)return;
		if(L<=l&&r<=R){
			And[p]=F(1,pre);
			return;
		}
		int mid=(l+r)>>1;
		if(L<=mid)change(ls,l,mid,L,R,pre);
		if(R>mid)change(rs,mid+1,r,L,R,pre);
	}

	F query(int p,int l,int r,int x){
		if(And[p].f)return And[p];
		if(l==r)return F(false,0);
		int mid=(l+r)>>1;
		if(x<=mid)return query(ls,l,mid,x);
		else return query(rs,mid+1,r,x);
	}

#undef ls
#undef rs

}st[2];

F f[maxn][2];

void out(bool o,int i){
	if(!i)return;
	out(o^1,f[i][o].pre);
	for(int j=f[i][o].pre+1;j<=i;j++)
		printf("%d ",o);
}

int main(){
	n=read<int>();
	m=read<int>();
	for(int i=1;i<=n;i++){
		val[i]=read<int>();
		for(int o=0;o<2;o++){
			L[o][i]=read<int>();
			R[o][i]=read<int>();
			lr[o][0][i-1].l=L[o][i];
			lr[o][0][i-1].r=R[o][i];
		}
	}
	er[0]=1;
	for(int i=1;i<=17;i++)
		er[i]=er[i-1]<<1;
	for(int o=0;o<2;o++)
		for(int i=1;i<=17;i++)
			for(int j=0;j+er[i]-1<=n;j++)
				lr[o][i][j]=lr[o][i-1][j]+lr[o][i-1][j+er[i-1]];
	for(int o=0;o<2;o++){
		for(int l=1,r=0;l<=n;l=r+1){
			while(r<n&&val[r+1]>=L[o][r+1]&&val[r+1]<=R[o][r+1])r++;
		    for(int i=l;i<=r;i++)can[o][0][i]=r;
			if(r<l)can[o][0][l]=l-1,r=l;
		}
		for(int i=0;i<=n;i++){
			if(can[o][0][i]<i)continue;
			int pos=i;
			for(int j=17;~j;j--)
				if(lr[o][j][pos].in(val[i]))
					pos+=er[j];
			can[o][1][i]=pos;
		}
	}
	for(int i=0;i<n;i++)
		for(int o=0;o<2;o++){
			f[i][o]=i?st[o].query(1,1,n,i):F(1,0);
			if(!f[i][o].f)continue;
			int r=min(can[o^1][0][i+1],can[o][1][i]);
			if(r>i)st[o^1].change(1,1,n,i+1,r,i);
		}
	f[n][0]=st[0].query(1,1,n,n);
	f[n][1]=st[1].query(1,1,n,n);
	if(!(f[n][0].f|f[n][1].f))
		return puts("No"),0;
	puts("Yes");
	if(f[n][0].f)out(0,n);
	else out(1,n);
    return 0;
}