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 <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
template <typename T> inline void read(T &x) {
	T f = 1, ch = getchar(); x = 0;
	while (!isdigit(ch)) { f = ch == '-' ? -1 : 1, ch = getchar(); }
	while (isdigit(ch)) { x = x * 10 + ch - 48, ch = getchar(); }
	x *= f;
}
template <typename T> void print(T x){
	if (x < 0) { putchar('-'), x = -x; }
	if (x > 9) { print( x / 10); }
	putchar(x % 10 + '0');
}
template <typename T,typename... Args> inline void read(T &t,Args&... args) {
	read(t);read(args...);
}

const int N = 1e5 + 9;
int n, m, lmin[N], lmax[N], rmin[N], rmax[N], cg[N], mincg[2], state[2], re[N][2], tag[2], lnowmax, lnowmin, rnowmax, rnowmin;

int main() {
    read(n, m);
    for (int i = 1; i <= n; ++i) {
        read(cg[i], lmin[i], lmax[i], rmin[i], rmax[i]);
    }
    lnowmax = rnowmax = m, lnowmin = rnowmin = 0;
    mincg[0] = mincg[1] = n + 1, state[0] = state[1] = 1;
    for (int i = n; i; --i) {
        state[0] &= cg[i] >= lmin[i] && cg[i] <= lmax[i];
        state[1] &= cg[i] >= rmin[i] && cg[i] <= rmax[i];
        lnowmax = min(lmax[i], lnowmax), lnowmin = max(lmin[i], lnowmin);
        rnowmax = min(rmax[i], rnowmax), rnowmin = max(rmin[i], rnowmin);
        tag[0] = state[0] && cg[i - 1] >= rnowmin && cg[i - 1] <= rnowmax;
        tag[1] = state[1] && cg[i - 1] >= lnowmin && cg[i - 1] <= lnowmax;
        if (tag[0]) re[i][0] = mincg[1];
        if (tag[1]) re[i][1] = mincg[0];
        if (tag[0]) mincg[0] = i, state[1] = 1, lnowmax = m, lnowmin = 0;
        if (tag[1]) mincg[1] = i, state[0] = 1, rnowmax = m, rnowmin = 0;
    }
    if (mincg[0] > 1 && mincg[1] > 1) puts("NO");
    else {
        puts("YES");
        int now = mincg[0] > 1;
        for (int i = 1; i <= n; i = re[i][now], now ^= 1) for(int j = i; j < re[i][now]; j++) printf("%d ", now);
    }
	return 0;
}