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 fi first
#define se second
#define mp make_pair
#define pb push_back
#define LC k<<1
#define RC k<<1|1
#define IO cin.sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define rep(i,a,n) for (int i = a; i < n; i++)
#define repn(i,a,n) for (int i = a; i <= n; i++)
#define per(i,a,n) for (int i = n - 1; i >= a; i--)
#define pern(i,a,n) for (int i = n; i >= a; i--)

typedef long long LL;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;

const int N = 110000;
const int M = 1100000;
const int mod = 1e9+7;
const int inf = (int)1e9;
const double eps = 1e-9;
int n, m;
int l1[N], r1[N], l2[N], r2[N];
int sum1[N], sum2[N], v[N];
int dp[2][N], way[2][N]; // 0 - left, 1 - right
int main()
{
	IO;
	cin >> n >> m;
	repn(i, 1, n) {
		cin >> v[i];
		cin >> l1[i] >> r1[i];
		cin >> l2[i] >> r2[i];
		sum1[i] = sum1[i - 1] + ((l1[i] <= v[i]) && (v[i] <= r1[i]));
		sum2[i] = sum2[i - 1] + ((l2[i] <= v[i]) && (v[i] <= r2[i]));
	}
	l1[n + 1] = l2[n + 1] = 0;
	r1[n + 1] = r2[n + 1] = m;
	int pos0 = n + 1, pos1 = n + 1;
	int lb1 = 0, rb1 = m, lb2 = 0, rb2 = m;
	pern(i, 0, n) {
		
		lb1 = max(lb1, l1[i]);
		rb1 = min(rb1, r1[i]);
		lb2 = max(lb2, l2[i]);
		rb2 = min(rb2, r2[i]);
		
		int lflag = 0, rflag = 0;
		if (v[i] >= lb1 && v[i] <= rb1 && sum2[pos0 - 1] - sum2[i] == pos0 - 1 - i) {
			dp[0][i] = 1;
			way[0][i] = pos0;
			lflag = 1;
		}
		
		if (v[i] >= lb2 && v[i] <= rb2 && sum1[pos1 - 1] - sum1[i] == pos1 - 1 - i) {
			dp[1][i] = 1;
			way[1][i] = pos1;
			rflag = 1;
		}
		if (lflag) {
			pos1 = i;
			lb2 = l2[i];
			rb2 = r2[i];
		}
		if (rflag) {
			pos0 = i;
			lb1 = l1[i];
			rb1 = r1[i];
		}
	}
	if (dp[0][0] || dp[1][0]) {
		cout << "Yes" << "\n";
		int idx, st, pos;
		if (dp[0][0]) idx = 0, st = 1, pos = way[0][0];
		else idx = 0, st = 0, pos = way[1][0];
		while (idx < n) {
			cout << st << " ";
			idx++;
			if (idx == pos) {
				pos = way[st][idx];
				st ^= 1;
			}
		}
	}
	else cout << "No" << "\n";
	return 0;
}