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 int long long
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FOD(i, a, b) for(int i = a; i >= b; i--)
#define II pair <int, int>
#define fi first
#define se second

const int N = 1e5 + 5;
int n, m, k[N], dpL[N], dpR[N], prL[N], prR[N], res[N];
II L[N], R[N], Range_L, Range_R;
int NextL, NextR;

void in() {
	cin >> n >> m;

	FOR(i, 1, n) {
		cin >> k[i];
		cin >> L[i].fi >> L[i].se;
		cin >> R[i].fi >> R[i].se;
	}
}

void find_path() {
	int cur;

	// cout << dpL[0] << ' ' << dpR[0] << endl;
	if(dpL[0] == 1) cur = 0;
	else cur = 1;

	// FOR(i, 0, n) {
	// 	cout << i << ' ' << prL[i] << ' ' << prR[i] << endl;
	// }

	int i = 0;

	while(i <= n) {
		res[i] = cur;

		if(cur == 0) {
			int jump = prL[i];

			FOR(j, i + 1, jump) res[j] = 1;
			i = jump;
			cur = 1;
		}
		else {
			int jump = prR[i];

			FOR(j, i + 1, jump) res[j] = 0;
			i = jump;
			cur = 0;
		}
	}

	FOR(i, 1, n) cout << res[i] << ' ';
}

void process() {
	int curL = n + 1, curR = n + 1;
	dpL[n + 1] = 1, dpR[n + 1] = 1;
	Range_L = {0, m}, Range_R = {0, m};
	NextL = n + 1, NextR = n + 1;

	FOD(i, n, 0) {
		int tmpL = curL, tmpR = curR;

		if(L[i].fi <= k[i] && k[i] <= L[i].se) {
			if(Range_L.fi <= k[i] && k[i] <= Range_L.se) {
				if(NextR >= curR && dpR[curR] == 1) {
					dpL[i] = 1;
					tmpL = i;
					prL[i] = curR;
				}
			}
		}

		if(R[i].fi <= k[i] && k[i] <= R[i].se) {
			if(Range_R.fi <= k[i] && k[i] <= Range_R.se) {
				if(NextL >= curL && dpL[curL] == 1) {
					dpR[i] = 1;
					tmpR = i;
					prR[i] = curL;
				}
			}
		}

		curL = tmpL, curR = tmpR;

		if(L[i].fi > k[i] || L[i].se < k[i]) NextL = i - 1;
		if(R[i].fi > k[i] || R[i].se < k[i]) NextR = i - 1;

		if(dpL[i] == 1) Range_R = {R[i].fi, R[i].se};
		else {
			int low = max(Range_R.fi, R[i].fi), high = min(Range_R.se, R[i].se);
			Range_R = {low, high};
		}

		if(dpR[i] == 1) Range_L = {L[i].fi, L[i].se};
		else {
			int low = max(Range_L.fi, L[i].fi), high = min(Range_L.se, L[i].se);
			Range_L= {low, high};
		}
	}

	if(dpL[0] == 0 && dpR[0] == 0) {
		cout << "No";
		exit(0);
	}

	// FOR(i, 0, n) {
	// 	cout << i << ' ' << dpL[i] << ' ' << dpR[i] << endl;
	// }

	cout << "Yes\n";
	find_path();
}

#undef int
int main() {
	if(fopen("trash.inp", "r"))
		freopen("trash.inp", "r", stdin), freopen("trash.out", "w", stdout);

	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	
	in();
	process();
}