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;
using cd = complex<double>;
#define ll long long
#define fi first
#define se second
#define PB push_back
#define MP make_pair
#define LB lower_bound
#define UB upper_bound
#define sz(a) int((a).size())
#define REP(i, a, b) for (int i = (int)a; i < (int)b; i++)
#define REPD(i, a, b) for (int i = (int)a - 1; i >= (int)b; i--)
#define VREP(it, v) for (auto it = v.begin(); it != v.end(); it++)
#define BIT(bs, i) (!!(bs&(1 << i)))
#define SQR(x) ((x)*(x))
#define LSONE(x) ((x)&(-x))
#define TRACE(x) cout << #x << " = " << x << endl
typedef pair<ll,ll> pi;
typedef vector<ll> vi;
typedef long double ld;
typedef pair<ld, ld> pd;

const ll MOD = 1000000009;
const double PI = acos(-1);

ll dp[100005][2];
ll n, m, k[100005], al, bl, ar, br;
pi a[100005][2];
ll la[100005][2];
pi cutter[100005][2];
vector<int> ans;

struct node{
	
	ll s, e, m;
	bool vall, valr;
	node *l, *r;
	node (ll _s, ll _e): s(_s), e(_e), m((_s + _e)/2), vall(0), valr(0){
		if (s != e){
			l = new node(s, m);
			r = new node(m + 1, e);
			vall = (l -> vall)&(r -> vall);
			valr = (l -> valr)&(r -> valr);
		} else {
			vall = (k[s] >= a[s][0].first && k[s] <= a[s][0].second)?1:0;
			valr = (k[s] >= a[s][1].first && k[s] <= a[s][1].second)?1:0;
		}
	}
	
	bool queryl(int x, int y){
		if (y < x) return false;
		if (s == x && e == y) return vall;
		if (x > m) return r -> queryl(x, y);
		if (y <= m) return l -> queryl(x, y);
		return (l -> queryl(x, m)) & (r -> queryl(m + 1, y));		
	}
	
	bool queryr(int x, int y){
		if (y < x) return false;
		if (s == x && e == y) return valr;
		if (x > m) return r -> queryr(x, y);
		if (y <= m) return l -> queryr(x, y);
		return (l -> queryr(x, m)) & (r -> queryr(m + 1, y));		
	}
	
} *root;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	memset(dp, -1, sizeof(dp));
	memset(la, -1, sizeof(la));
	cin >> n >> m;
	REP(i, 0, n){
		cin >> k[i];
		cin >> a[i][0].first >> a[i][0].second;
		cin >> a[i][1].first >> a[i][1].second;
	}
	
	root = new node(0, n - 1);
	
	for (int i = n - 1; i >= 0; i--){
		if (i == n - 1){
			dp[i][0] = ((k[i] <= a[i][0].second && k[i] >= a[i][0].first)?1:0);
			dp[i][1] = ((k[i] <= a[i][1].second && k[i] >= a[i][1].first)?1:0);
			cutter[i][0] = MP(0, m);
			cutter[i][1] = MP(0, m);
			if (dp[i][0]){
				la[i][0] = i;
				cutter[i][1] = a[i][1];
			}
			if (dp[i][1]){
				la[i][1] = i;
				cutter[i][0] = a[i][0];
			}
			continue;
		}
		ll xx = la[i + 1][1];
		ll yy = la[i + 1][0];
		bool left = (xx == -1)?false:true;
		left = (left&&(root -> queryr(i + 1, xx)));

		if (k[i] < a[i][0].first || k[i] > a[i][0].second){
			left = false;
		}
		if (k[i] < cutter[i + 1][0].first || k[i] > cutter[i + 1][0].second){
			left = false;
		}
		dp[i][0] = left;
		
		bool right = (yy == -1)?false:true;
		right = (right&&(root -> queryl(i + 1, yy)));

		if (k[i] < a[i][1].first || k[i] > a[i][1].second){
			right = false;
		}
		if (k[i] < cutter[i + 1][1].first || k[i] > cutter[i + 1][1].second){
			right = false;
		}
		dp[i][1] = right;
		
		if (dp[i][0]){
			la[i][0] = i;
			//cutter[i][0] = a[i][0];
			cutter[i][1] = a[i][1];
		} else {
			la[i][0] = la[i + 1][0];
			cutter[i][1] = MP(max(cutter[i + 1][1].first, a[i][1].first), min(cutter[i + 1][1].second, a[i][1].second));
			//cutter[i][0] = MP(max(cutter[i + 1][0].first, a[i][0].first), min(cutter[i + 1][0].second, a[i][0].second));
		}
		
		if (dp[i][1]){
			la[i][1] = i;
			cutter[i][0] = a[i][0];
			//cutter[i][1] = a[i][1];
		} else {
			la[i][1] = la[i + 1][1];
			cutter[i][0] = MP(max(cutter[i + 1][0].first, a[i][0].first), min(cutter[i + 1][0].second, a[i][0].second));
			//cutter[i][1] = MP(max(cutter[i + 1][1].first, a[i][1].first), min(cutter[i + 1][1].second, a[i][1].second));
		}
		
	}
	
	int xxx = la[0][0];
	if (xxx != -1){
		bool can = true;
		for (int i = 0; i < xxx; i++){
			if (k[i] > a[i][0].second || k[i] < a[i][0].first){
				can = false;
			}
		}
		for (int i = 0; i < xxx+1; i++){
			if (0 > a[i][1].second || 0 < a[i][1].first){
				can = false;
			}
		}
		if (can){
			cout << "Yes" << endl;
			int c = 0;
			int cc = xxx;
			int bit = 0;
			while (c < n){
				for (int i = c; i <= cc; i++){
					ans.PB(bit);
				}
				c = cc + 1;
				cc = la[cc + 1][1 - bit];
				bit = 1 - bit;
			}
			VREP(it, ans){
				if (it == ans.begin()) cout << *it;
				else cout << " " << *it;
			}
			cout << endl;
			return 0;
		}
	}
	
	xxx = la[0][1];
	if (xxx != -1){
		bool can = true;
		for (int i = 0; i < xxx; i++){
			if (k[i] > a[i][1].second || k[i] < a[i][1].first){
				can = false;
			}
		}
		for (int i = 0; i < xxx+1; i++){
			if (0 > a[i][0].second || 0 < a[i][0].first){
				can = false;
			}
		}
		if (can){
			cout << "Yes" << endl;
			int c = 0;
			int cc = xxx;
			int bit = 1;
			while (c < n){
				for (int i = c; i <= cc; i++){
					ans.PB(bit);
				}
				c = cc + 1;
				cc = la[cc + 1][1 - bit];
				bit = 1 - bit;
			}
			VREP(it, ans){
				if (it == ans.begin()) cout << *it;
				else cout << " " << *it;
			}
			cout << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

//cout.flush()
//cout << fixed << setprecision(9) << x << endl;