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>
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define ll long long
using namespace std;
int dp[500005][2];
int n,m;
int K[100005];
int a[2][100005];
int b[2][100005];
vector<int> big;
set<int> op[2];
int sum[2];
map<pair<int,pii>,int> rec;
int main(){
	scanf("%d %d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%d",&K[i]);
		scanf("%d %d",&a[0][i],&b[0][i]);
		scanf("%d %d",&a[1][i],&b[1][i]);
		big.pb(a[0][i]);big.pb(b[0][i]);
		big.pb(a[1][i]);big.pb(b[1][i]);
		big.pb(K[i]);
	}
	big.pb(0);
	sort(big.begin(),big.end());
	big.resize(unique(big.begin(),big.end())-big.begin());
	for(int i=1;i<=n;i++){
		K[i]=lower_bound(big.begin(),big.end(),K[i])-big.begin()+1;
		a[0][i]=lower_bound(big.begin(),big.end(),a[0][i])-big.begin()+1;
		b[0][i]=lower_bound(big.begin(),big.end(),b[0][i])-big.begin()+1;
		a[1][i]=lower_bound(big.begin(),big.end(),a[1][i])-big.begin()+1;
		b[1][i]=lower_bound(big.begin(),big.end(),b[1][i])-big.begin()+1;
	}
	if(a[0][1]<=1 && 1<=b[0][1] && a[1][1]<=K[1] && K[1]<=b[1][1]) dp[1][1]=1,sum[1]++,op[1].insert(1);
	if(a[0][1]<=K[1] && K[1]<=b[0][1] && a[1][1]<=1 && 1<=b[1][1]) dp[1][0]=1,sum[0]++,op[0].insert(1);
	for(int i=2;i<=n;i++){
		int nsum[2]={sum[0],sum[1]};
		int now_op[2]={(op[0].size()?*op[0].begin():0),(op[1].size()?*op[1].begin():0)};
		for(int j=0;j<=1;j++){
			if(a[j][i]<=K[i] && K[i]<=b[j][i] && sum[j]){
				while(!op[j].empty() && *op[j].begin()<a[j^1][i]) dp[*op[j].begin()][j]=0,op[j].erase(op[j].begin()),sum[j]--;
				set<int>::iterator it=op[j].end();
				while(!op[j].empty() && *(--it)>b[j^1][i]) dp[*it][j]=0,op[j].erase(it),it=op[j].end(),sum[j]--;
			}
			else{
				while(!op[j].empty()) dp[*op[j].begin()][j]=0,op[j].erase(op[j].begin());
				sum[j]=0;
			}
			if(a[j][i]<=K[i] && K[i]<=b[j][i] && a[j^1][i]<=K[i-1] && K[i-1]<=b[j^1][i]){
				if(nsum[j^1] && op[j].find(K[i-1])==op[j].end()) op[j].insert(K[i-1]),sum[j]++;
				dp[K[i-1]][j]|=(nsum[j^1]>0);
				if(nsum[j^1]) rec[mp(i,mp(K[i-1],j))]=now_op[j^1];
			}
			/*cout<<i<<endl;
			for(int k=1;k<=min((int)big.size(),m);k++)
				cout<<dp[k][0]<<" "<<dp[k][1]<<endl;
			cout<<endl;*/
		}
	}
	pair<int,pii> now;
	for(int i=1;i<=min(m,5*n);i++)
		for(int j=0;j<=1;j++)
			if(dp[i][j]){
				now=mp(n,mp(i,j));
				break;
			}
	if(now.fi!=0) puts("Yes");
	else{
		puts("No");
		return 0;
	}
	vector<int> ans;ans.pb(now.se.se);
	for(;now.fi!=1;){
		if(rec.find(now)!=rec.end()){
			now.se.fi=rec[now];
			now.fi--;
			now.se.se^=1;
			ans.pb(now.se.se);
		}
		else{
			now.fi--;
			ans.pb(now.se.se);
		}
	}
	reverse(ans.begin(),ans.end());
	for(int i=0;i<(int)ans.size();i++)
		printf("%d ",ans[i]);
	puts("");
	return 0;
}