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 "stdio.h" 
#include "algorithm" 
#include "stdlib.h" 
#include "set" 
#include "map" 
#include "queue" 
#include "vector"
#include "math.h" 
#include "time.h"
#include "stack" 

// #define int long long

int Max(int a, int b) {
	return a > b? a: b; 
}
int Min(int a, int b) {
	return a < b? a: b; 
}
int Abs(int a) {
	return a < 0? -a: a; 
}
long long sqr(int a) {
	return (long long)a * a; 
}
int qpow(int a, int b) {
	int ans = 1; 
	while (b) {
		if (b & 1) 
			ans = 1ll * a * ans % 1000000007; 
		a = 1ll * a * a % 1000000007; 
		b >>= 1; 
	}
	return ans; 
}
int gcd(int a, int b) {
	return b? gcd(b, a % b): a; 
}

int T; 
int n, m; 
int pr[200010][2]; 

struct Qt {
	int ls[4000010], rs[4000010], mx[4000010]; 
	int rt, cnt; 
	void pushup(int x) {
		if (mx[rs[x]]) 
			mx[x] = mx[rs[x]]; 
		else 
			mx[x] = mx[ls[x]]; 
	}
	void pushdown(int x) {
		if (mx[x]) 
			return; 
		if (ls[x]) 
			mx[ls[x]] = 0; 
		if (rs[x]) 
			mx[rs[x]] = 0; 
	}
	void upd(int &x, int pos, int val, int l = 0, int r = m) {
		if (!x) 
			x = ++ cnt; 
		if (l == r) {
			mx[x] = val; 
			return; 
		}
		pushdown(x); 
		int mid = (l + r) >> 1; 
		if (pos <= mid) 
			upd(ls[x], pos, val, l, mid); 
		else 
			upd(rs[x], pos, val, mid + 1, r); 
		pushup(x); 
	}
	void del(int x, int posl, int posr, int l = 0, int r = m) {
		if (posl > posr || !x) 
			return; 
		if (l >= posl && r <= posr) {
			mx[x] = 0; 
			return; 
		}
		pushdown(x); 
		int mid = (l + r) >> 1; 
		if (posl <= mid) 
			del(ls[x], posl, posr, l, mid); 
		if (posr > mid) 
			del(rs[x], posl, posr, mid + 1, r); 
		pushup(x); 
	}
	int qry(int x, int posl, int posr, int l = 0, int r = m) {
		if (!x) 
			return 0; 
		if (l >= posl && r <= posr) 
			return mx[x]; 
		pushdown(x); 
		int mid = (l + r) >> 1, ans = 0; 
		if (posr > mid) 
			ans = qry(rs[x], posl, posr, mid + 1, r); 
		if (posl <= mid && !ans) 
			ans = qry(ls[x], posl, posr, l, mid); 
		return ans; 
	}
} lt, rt; 

void prt(int x, int opt) {
	if (pr[x][opt] - 1) 
		prt(pr[x][opt], !opt); 
	for (int i = pr[x][opt] + 1; i <= x; ++ i) 
		printf("%d ", opt); 
}

int main() {
	// scanf("%d", &T); 
	T = 1; 
	while (T --) {
		scanf("%d%d", &n, &m); 
		lt.upd(lt.rt, 0, 1); 
		rt.upd(rt.rt, 0, 1); 
		int k, ll, lr, rl, rr, flg1, flg2; 
		for (int i = 2; i <= n + 1; ++ i) {
			flg1 = 0, flg2 = 0; 
			scanf("%d%d%d%d%d", &k, &ll, &lr, &rl, &rr); 
			if (ll <= k && k <= lr) {
				pr[i][0] = rt.qry(1, rl, rr); 
				if (pr[i][0]) 
					flg1 = 1; 
			}
			if (rl <= k && k <= rr) {
				pr[i][1] = lt.qry(1, ll, lr); 
				if (pr[i][1]) 
					flg2 = 1; 
			}
			if (!flg1 && !flg2) {
				// printf("%d %d %d\n", i, flg1, flg2); 
				// printf("%d\n", rt.qry(1, rl, rr)); 
				puts("No"); 
				return 0; 
			}
			if (flg1 && flg2) {
				lt.del(1, 0, ll - 1), lt.del(1, lr + 1, m); 
				rt.del(1, 0, rl - 1), rt.del(1, rr + 1, m); 
				lt.upd(lt.rt, k, i), rt.upd(rt.rt, k, i); 
			}
			if (flg1 && !flg2) {
				lt.del(1, 0, m); 
				lt.upd(lt.rt, k, i); 
				rt.del(1, 0, rl - 1), rt.del(1, rr + 1, m); 
			}
			if (!flg1 && flg2) {
				lt.del(1, 0, ll - 1), lt.del(1, lr + 1, m); 
				rt.del(1, 0, m); 
				rt.upd(rt.rt, k, i); 
			}
		}
		puts("Yes"); 
		pr[n + 1][0]? prt(n + 1, 0): prt(n + 1, 1); 
	}
	// #ifndef ONLINE_JUDGE 
	// 	while (1); 
	// #endif 
}

// Max(l, n)
// 
// 
// 
// 
// 
// 

// dp[i][j][k]: now=i, insert(j, j+1), Max=k  

// dp[i][j][k] -> dp[i + 1][j][k],