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;
inline int read()
{
    int w = 0, f = 1;
    char ch = getchar();
    while (ch < '0' or ch > '9')
    {
        if (ch == '-')
            f = -f;
        ch = getchar();
    }
    while (ch >= '0' and ch <= '9')
        w = w * 10 + ch - '0', ch = getchar();
    return w * f;
}
const int maxn = 1e5 + 5;
int st[2][2][maxn][20], n, k[maxn], l[2][maxn], r[2][maxn], sta[2][maxn][20], Log2[maxn];
void init()
{
    for (int i = 1; i <= n; i++)
    {
        st[0][0][i][0] = l[0][i];
        st[0][1][i][0] = r[0][i];
        st[1][0][i][0] = l[1][i];
        st[1][1][i][0] = r[1][i];
        sta[0][i][0] = (k[i] >= l[0][i] and k[i] <= r[0][i]);
        sta[1][i][0] = (k[i] >= l[1][i] and k[i] <= r[1][i]);
    }
    for (int t = 0; t < 2; t++)
        for (int i = 1; i < 20; i++)
            for (int j = 1; j <= n; j++)
            {
                int k = min(n, j + (1 << (i - 1)));
                st[t][0][j][i] = max(st[t][0][j][i - 1], st[t][0][k][i - 1]);
                st[t][1][j][i] = min(st[t][1][j][i - 1], st[t][1][k][i - 1]);
                sta[t][j][i] = min(sta[t][j][i - 1], sta[t][k][i - 1]);
            }
    for (int i = 1; i <= n; i++)
    {
        if (i > (1 << Log2[i - 1]) << 1)
            Log2[i] = Log2[i - 1] + 1;
        else
            Log2[i] = Log2[i - 1];
    }
}
int f[maxn][2], dp[maxn][2];
int ask1(int l, int r, int t1, int t2)
{
    int len = Log2[r - l + 1];
    if (t2)
        return min(st[t1][t2][l][len], st[t1][t2][r - (1 << len) + 1][len]);
    return max(st[t1][t2][l][len], st[t1][t2][r - (1 << len) + 1][len]);
}
int ask2(int l, int r, int t)
{
    int len = Log2[r - l + 1];
    return min(sta[t][l][len], sta[t][r - (1 << len) + 1][len]);
}
bool check1(int l, int r, int x, int t)
{
    return (x >= ask1(l, r, t, 0) and x <= ask1(l, r, t, 1));
}
bool check2(int l, int r, int t)
{
    return ask2(l, r, t);
}
int ans[maxn], c[maxn][2];
void add(int x, int y, int t)
{
    for (; x <= n + 1; x += x & -x)
        c[x][t] += y;
}
int ask(int x, int t)
{
    int ans = 0;
    for (; x; x -= x & -x)
        ans += c[x][t];
    return ans;
}
int main()
{
    n = read();
    int m = read();
    for (int i = 1; i <= n; i++)
        k[i] = read(), l[0][i] = read(), r[0][i] = read(), l[1][i] = read(), r[1][i] = read();
    init();
    f[0][0] = 1, f[0][1] = 1;
    for (int i = 0; i <= n; i++)
    {
        for (int t = 0; t < 2; t++)
        {
            int l = i + 1, r = n;
            while (l <= r)
            {
                int mid = (l + r) >> 1;
                if (check1(i, mid, k[i], t) and check2(i + 1, mid, t ^ 1))
                    l = mid + 1;
                else
                    r = mid - 1;
            }
            f[i][t] = r;
            if (ask(i, t) or i == 0)
                add(i + 1, 1, t ^ 1), add(f[i][t] + 1, -1, t ^ 1);
        }
    }
    for (int i = 1; i <= n; i++)
        for (int t = 0; t < 2; t++)
            dp[i][t] = ask(i, t);
    printf((dp[n][0] or dp[n][1]) ? "Yes\n" : "No\n");
    if (dp[n][0] or dp[n][1])
    {
        int t;
        if (dp[n][0])
            t = 0;
        else
            t = 1;
        ans[n] = t;
        int last = n;
        for (int i = n - 1; i >= 0; i--)
        {
            if (dp[i][t ^ 1] and f[i][t ^ 1] >= last)
            {
                for (int j = i + 1; j < last; j++)
                    ans[j] = t;
                ans[i] = t ^ 1;
                t ^= 1, last = i;
            }
        }
        for (int i = 1; i < last; i++)
            ans[i] = t;
        for (int i = 1; i <= n; i++)
            printf("%d ", ans[i]);
    }
    return 0;
}