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;

typedef long long ll;
typedef pair<ll, ll> pll;

#define all(x)                      (x).begin(),(x).end()
#define X                           first
#define Y                           second
#define sep                         ' '
#define endl                        '\n'
#define debug(x)                    cerr << #x << ": " <<  x << endl;

const ll MAXN = 1e5 + 10; // TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;
const ll LOG = 18;

int LOG_TB[MAXN], n, q, K[MAXN], LA[MAXN], RA[MAXN], LB[MAXN], RB[MAXN], mx_a[MAXN], mx_b[MAXN];
pair<int, bool> dp[MAXN][2];

struct SparseTable {
	int SP[MAXN][LOG], n;
	bool C = false;

	SparseTable() {}
	SparseTable(int* A, int tn, bool B) {
		n = tn;
		C = B;
		for (int i = 0; i <= n; i++) SP[i][0] = A[i];
		for (int j = 1; j < LOG; j++) {
			for (int i = 0; i <= n; i++) {
				int ti = min(i + (1 << (j - 1)), n);
				if (C) SP[i][j] = max(SP[i][j - 1], SP[ti][j - 1]);
				else SP[i][j] = min(SP[i][j - 1], SP[ti][j - 1]);
			}
		}
	}

	int Query(int L, int R) {
		int g = LOG_TB[R - L + 1];
		if (C) return max(SP[L][g], SP[R - (1 << g) + 1][g]);
		else return min(SP[L][g], SP[R - (1 << g) + 1][g]);
	}
};

SparseTable la, lb, ra, rb;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> q;
	for (int i = 2; i < MAXN; i++) LOG_TB[i] = LOG_TB[i / 2] + 1;

	for (int i = 1; i <= n; i++) cin >> K[i] >> LA[i] >> RA[i] >> LB[i] >> RB[i];
	la = SparseTable(LA, n, true);
	lb = SparseTable(LB, n, true);
	ra = SparseTable(RA, n, false);
	rb = SparseTable(RB, n, false);

	

	for (int i = 0; i <= n; i++) {
		int L = i, R = n + 1;
		while (L < R) {
			int mid = (L + R) >> 1;
			if (mid == n + 1) {
				L = R = n + 1;
				break;
			}

			if (la.Query(i, mid) > K[i] || ra.Query(i, mid) < K[i]) R = mid;
			else L = mid + 1;
		}
		mx_a[i] = L;

		L = i, R = n + 1;
		while (L < R) {
			int mid = (L + R) >> 1;
			if (mid == n + 1) {
				L = R = n + 1;
				break;
			}

			if (lb.Query(i, mid) > K[i] || rb.Query(i, mid) < K[i]) R = mid;
			else L = mid + 1;
		}
		mx_b[i] = L;
	}
	
	dp[0][0] = {mx_b[0], false};
	dp[0][1] = {mx_a[0], false};
	for (int i = 1; i <= n; i++) {
		dp[i][0] = dp[i][1] = {-1, false};
		if (mx_a[i] > i && dp[i - 1][0].X > i) dp[i][0] = {dp[i - 1][0].X, false};
		if (mx_a[i] > i && mx_b[i - 1] > max(i, dp[i][0].X) && dp[i - 1][1].X > i - 1) dp[i][0] = {mx_b[i - 1], true};

		if (mx_b[i] > i && dp[i - 1][1].X > i) dp[i][1] = {dp[i - 1][1].X, false};
		if (mx_b[i] > i && mx_a[i - 1] > max(i, dp[i][1].X) && dp[i - 1][0].X > i - 1) dp[i][1] = {mx_a[i - 1], true};
	}
	

	int ind = 2;
	if (dp[n][1].X > n) ind = 1;
	if (dp[n][0].X > n) ind = 0;
	if (ind == 2) return cout << "No" << endl, 0;
	cout << "Yes" << endl;
	
	stack<int> st;
	while (n > 0) {
		st.push(ind);
		if (dp[n][ind].Y) ind = 1 - ind;
		n--;
	}

	while (!st.empty()) {
		cout << st.top() << sep;
	       	st.pop();
	}

	cout << endl;
	return 0;
}