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:
//
// Created by dog_jake on 20.06.2021
//

#include <bits/stdc++.h>
using namespace std;

//#define int long long
#define FF first
#define SS second
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define mp make_pair
#define pb push_back
#define pf push_front

using ll = long long;
using ld = long double;

const int INFI = 1e9 + 228;
const ll INFL = 1e18 + 228;
const ld INFLD = 1e18 + 228;
const ld PI = acos(-1);
const int MAXN = 1e5 + 228;

vector<pair<int, int> > DD = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
int st = (1 << 17);
int maxl[2 * (1 << 17) + 228];
int maxr[2 * (1 << 17) + 228];
int minl[2 * (1 << 17) + 228];
int minr[2 * (1 << 17) + 228];
vector<pair<pair<int, int>, pair<int, int> > > mass;
void build(int v, int vil, int vir) {
    if (vil + 1 == vir) {
        if (vil >= mass.size()) {
            maxl[v] = -INFI;
            maxr[v] = -INFI;
            minl[v] = INFI;
            minr[v] = INFI;
            return;
        }
        maxl[v] = mass[vil].FF.FF;
        maxr[v] = mass[vil].SS.FF;
        minl[v] = mass[vil].FF.SS;
        minr[v] = mass[vil].SS.SS;
        return;
    }
    build(2 * v, vil, (vil + vir) / 2);
    build(2 * v + 1, (vil + vir) / 2, vir);
    maxl[v] = max(maxl[2 * v], maxl[2 * v + 1]);
    maxr[v] = max(maxr[2 * v], maxr[2 * v + 1]);
    minl[v] = min(minl[2 * v], minl[2 * v + 1]);
    minr[v] = min(minr[2 * v], minr[2 * v + 1]);
    return;
}
pair<int, int> getl(int v, int vil, int vir, int l, int r) {
    if (vir <= l || r <= vil) return {INFI, -INFI};
    if (l <= vil && vir <= r) {
        return {minl[v], maxl[v]};
    }
    pair<int, int> lef = getl(2 * v, vil, (vil + vir) / 2, l, r);
    pair<int, int> rig = getl(2 * v + 1, (vil + vir) / 2, vir, l, r);
    return {min(lef.FF, rig.FF), max(lef.SS, rig.SS)};
}
pair<int, int> getr(int v, int vil, int vir, int l, int r) {
    if (vir <= l || r <= vil) return {INFI, -INFI};
    if (l <= vil && vir <= r) {
        return {minr[v], maxr[v]};
    }
    pair<int, int> lef = getr(2 * v, vil, (vil + vir) / 2, l, r);
    pair<int, int> rig = getr(2 * v + 1, (vil + vir) / 2, vir, l, r);
    return {min(lef.FF, rig.FF), max(lef.SS, rig.SS)};
}
int max_next_left[MAXN], max_next_right[MAXN];
int dp[MAXN][2], pred[MAXN][2];
int anses[MAXN];
void run() {
    mass.pb({{0, 0}, {0, 0}});
    int n, m;
    cin >> n >> m;
    vector<int> upd;
    upd.pb(0);
    for (int i = 0; i < n; ++i) {
        int k;
        cin >> k;
        upd.pb(k);
        int al, bl, ar, br;
        cin >> al >> bl >> ar >> br;
        mass.pb({{al, bl}, {ar, br}});
    }
    build(1, 0, st);
    for (int i = 0; i <= n; ++i) {
        int L = i - 1, R = n + 1;
        while (R - L > 1) {
            int M = (L + R) / 2;
            pair<int, int> now = getl(1, 0, st, i, M + 1);
            if (now.SS <= upd[i] && upd[i] <= now.FF) L = M;
            else R = M;
        }
        max_next_left[i] = L;
        L = i - 1, R = n + 1;
        while (R - L > 1) {
            int M = (L + R) / 2;
            pair<int, int> now = getr(1, 0, st, i, M + 1);
            if (now.SS <= upd[i] && upd[i] <= now.FF) L = M;
            else R = M;
        }
        max_next_right[i] = L;
    }
    //cout << "#" << endl;
    dp[0][0] = 1;
    dp[0][1] = 1;
    //cout << "#" << endl;
    pred[0][0] = -1;
    pred[0][1] = -1;
    //cout << "#" << endl;
    int nowmaxl = max_next_left[0], nowmaxr = max_next_right[0];
    int posl = 0, posr = 0;
    //cout << "#" << endl;
    for (int i = 1; i <= n; ++i) {
        if (nowmaxr >= i && mass[i].FF.FF <= upd[i] && upd[i] <= mass[i].FF.SS) {
            dp[i][0] = true;
            pred[i][0] = posr;
        }
        if (nowmaxl >= i && mass[i].SS.FF <= upd[i] && upd[i] <= mass[i].SS.SS) {
            dp[i][1] = true;
            pred[i][1] = posl;
        }
        if (!dp[i][0]) {
            nowmaxr = -1;
            posr = -1;
        }
        if (!dp[i][1]) {
            nowmaxl = -1;
            posl = -1;

        }
        if (dp[i][0]) {
            if (nowmaxl < max_next_left[i]) {
                nowmaxl = max_next_left[i];
                posl = i;
            }
        }
        if (dp[i][1]) {
            if (nowmaxr < max_next_right[i]) {
                nowmaxr = max_next_right[i];
                posr = i;
            }
        }
    }
    //cout << "#" << endl;
    for (int i = 1; i <= n; ++i) {
        if (!dp[i][0] && !dp[i][1]) {
            cout << "No" << endl;
            return;
        }
    }
    if (dp[n][0]) {
        int ind = 0, start = n;
        while (start > 0) {
            for (int i = pred[start][ind] + 1; i <= start; ++i) {
                anses[i] = ind;
            }
            start = pred[start][ind];
            ind = 1 - ind;
        }
    } else {
        int ind = 1, start = n;
        while (start > 0) {
            for (int i = pred[start][ind] + 1; i <= start; ++i) {
                anses[i] = ind;
            }
            start = pred[start][ind];
            ind = 1 - ind;
        }
    }
    cout << "Yes" << endl;
    for (int i = 1; i <= n; ++i) cout << anses[i] << ' ';
    cout << endl;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    //cin >> t;
    t = 1;
    while (t--) run();
    return 0;
}