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 ll long long
# define read read1<ll>()
# define Type template<typename T>
Type T read1(){
	T t=0;
	char k;
	bool vis=0;
	do (k=getchar())=='-'&&(vis=1);while('0'>k||k>'9');
	while('0'<=k&&k<='9')t=(t<<3)+(t<<1)+(k^'0'),k=getchar();
	return vis?-t:t;
}
# define fre(k) freopen(k".in","r",stdin);freopen(k".out","w",stdout)
struct A{
	int l,r,v;
	A(int _l=1,int _r=0,int _v=0){l=_l;r=_r;v=_v;}
	A operator &(const A &b){return A(max(l,b.l),min(r,b.r),v&b.v);}
}sl[100005][17],sr[100005][17];
int s,k[100005],la[100005][2];
pair<int,int>a[100005],b[100005];
void pr(int n,bool p){
	if(n==1)return;
	pr(la[n][p],p^1);
	for(int i=la[n][p];i<n;++i)
		putchar(p^'1'),putchar(' ');
}
int main(){
	s=read;read;
	for(int i=1;i<=s;++i){
		k[i]=read;
		a[i].first=read;
		a[i].second=read;
		b[i].first=read;
		b[i].second=read;
		sr[i][0]=A(a[i].first,a[i].second,b[i].first<=k[i]&&k[i]<=b[i].second);
		sl[i][0]=A(b[i].first,b[i].second,a[i].first<=k[i]&&k[i]<=a[i].second);
	}for(int i=s;i;--i)
		for(int j=0;i+(1<<j+1)-1<=s;++j){
			sl[i][j+1]=sl[i][j]&sl[i+(1<<j)][j];
			sr[i][j+1]=sr[i][j]&sr[i+(1<<j)][j];
		}
	int xl=1,xr=1;
	for(int i=1;i<=s;++i){
		int tv=xr;
		if(xl>=i&&a[i].first<=k[i]&&k[i]<=a[i].second&&b[i].first<=k[i-1]&&k[i-1]<=b[i].second){
			int j=i;
			for(int x=17;x--;)
				if(sl[j][x].v&&sl[j][x].l<=k[i-1]&&k[i-1]<=sl[j][x].r)
					j+=1<<x;
			while(xr<j)la[++xr][1]=i;
		}
		if(tv>=i&&b[i].first<=k[i]&&k[i]<=b[i].second&&a[i].first<=k[i-1]&&k[i-1]<=a[i].second){
			int j=i;
			for(int x=17;x--;)
				if(sr[j][x].v&&sr[j][x].l<=k[i-1]&&k[i-1]<=sr[j][x].r)
					j+=1<<x;
			while(xl<j)la[++xl][0]=i;
		}
	}
	if(xl<=s&&xr<=s)return puts("No"),0;
	puts("Yes");
	if(xl>s)pr(s+1,0);
	else pr(s+1,1);
	return 0;
}