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 sf(x) scanf("%d", &x)
#define lsf(x) scanf("%lld", &x)
#define pf(x) printf("%d\n", x)
#define lpf(x) printf("%lld\n",x)
#define rep(i,x,y) for(int i=x;i<y;i++)  
#define repp(i,x,y) for(int i=x;i<=y;i++)
#define mem(a,x) memset(a,x,sizeof(a))  
#define min(a,b)    (((a) < (b)) ? (a) : (b))
#define max(a,b)    (((a) > (b)) ? (a) : (b))
#define abs(x)    ((x) < 0 ? -(x) : (x))
#define all(x) x.begin(),x.end()
#define sz(x) (x).size()
#define pb push_back
#define x first
#define y second
#define bug(x) cerr<<#x<<'='<<x<<' '
#define debug(x) cerr<<#x<<'='<<x<<endl
#define gcd(a,b) __gcd(a,b)  

#define mod 1000000007
#define INF 0x3f3f3f3f3f
#define delta 0.85
#define eps 1e-6	
#define PI 3.14159265358979323846
#define MAX_N 100010
#define MAX_M 200010

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
int n, m;
int al[MAX_N], bl[MAX_N], ar[MAX_N], br[MAX_N], k[MAX_N];
int l[MAX_N][2], r[MAX_N][2];
void solve() {
	sf(n);
	sf(m);
	repp(i, 1, n) {
		sf(k[i]);
		scanf("%d%d", &al[i], &bl[i]);
		scanf("%d%d", &ar[i], &br[i]);
		//bug(k[i]), bug(al[i]), bug(bl[i]), bug(ar[i]), debug(br[i]);
	}
	
	l[n + 1][0] = 0, r[n + 1][0] = m;
	l[n + 1][1] = 0, r[n + 1][1] = m;
	
	for (int i = n; i >= 1; i -- ) {
		if (k[i] >= al[i] && k[i] <= bl[i]) {
			l[i][0] = ar[i];
			r[i][0] = br[i];
			
			if (k[i] < l[i + 1][1] || k[i] > r[i + 1][1]) {
				l[i][0] = max(l[i][0], l[i + 1][0]);
				r[i][0] = min(r[i][0], r[i + 1][0]);
			}
			
		}
		else {
			l[i][0] = m;
			r[i][0] = 0;
		}
		
		if (k[i] >= ar[i] && k[i] <= br[i]) {
			l[i][1] = al[i];
			r[i][1] = bl[i];
		
			if (k[i] < l[i + 1][0] || k[i] > r[i + 1][0]) {
			 	l[i][1] = max(l[i][1], l[i + 1][1]);
				r[i][1] = min(r[i][1], r[i + 1][1]);
			}
		} 
		else {
			l[i][1] = m;
			r[i][1] = 0;
		}
	}

	if (l[1][0] > 0 && l[1][1] > 0) {
		puts("No");
		return;	
	}
	
	puts("Yes");
	int ans_l = 0, ans_r = 0;
	repp(i, 1, n) {
		if(ans_r >= l[i][0] && ans_r <= r[i][0]) {
			ans_l = k[i];
			cout << 0 << ' ';
		} 
		else if (ans_l >= l[i][1] && ans_l <= r[i][1]) {
			ans_r = k[i];
			cout << 1 << ' ';
		}
	}
	cout << endl;
}


int main() {
	int t;
 	t = 1;
	while (t --) {
		solve();
	} 
	return 0;
}