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;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    set<pair<int, int>> sl, sr;
    sl.emplace(0, -1);
    sr.emplace(0, -1);
    set<int> tl, tr;
    tl.emplace(-1);
    tr.emplace(-1);
    vector<int> ans(n, -1);
    auto del_range = [&](set<pair<int, int>>& st, set<int>& tt, int lo, int hi) {
        while (!st.empty() && (*st.begin()).first < lo) {
            tt.erase((*st.begin()).second);
            st.erase(st.begin());
        }
        while (!st.empty() && (*prev(st.end())).first > hi) {
            tt.erase((*prev(st.end())).second);
            st.erase(prev(st.end()));
        }
    };
    vector<int> x(n, -2), y(n, -2);
    for (int i = 0; i < n; i++) {
        debug(sl, sr);
        int k, al, bl, ar, br;
        cin >> k >> al >> bl >> ar >> br;
        if ((k < al || bl < k) && (k < ar || br < k)) {
            cout << "No" << '\n';
            return 0;
        } else if (al <= k && k <= bl && ar <= k && k <= br) {
            del_range(sl, tl, al, bl);
            del_range(sr, tr, ar, br);
            if (sl.empty() && sr.empty()) {
                cout << "No" << '\n';
                return 0;
            }
            if (sl.empty()) {
                ans[i] = 0;
                sl.emplace(k, i);
                tl.emplace(i);
            } else if (sr.empty()) {
                ans[i] = 1;
                sr.emplace(k, i);
                tr.emplace(i);
            } else {
                sl.emplace(k, i);
                sr.emplace(k, i);
                tl.emplace(i);
                tr.emplace(i);
            }
        } else if (k < al || bl < k) {
            ans[i] = 1;
            sr.clear();
            tr.clear();
            sr.emplace(k, i);
            tr.emplace(i);
            del_range(sl, tl, al, bl);
            if (sl.empty()) {
                cout << "No" << '\n';
                return 0;
            }
        } else if (k < ar || br < k) {
            ans[i] = 0;
            sl.clear();
            tl.clear();
            sl.emplace(k, i);
            tl.emplace(i);
            del_range(sr, tr, ar, br);
            if (sr.empty()) {
                cout << "No" << '\n';
                return 0;
            }
        }
        debug(sl);
        debug(sr);
        x[i] = *tl.begin();
        y[i] = *tr.begin();
    }
    int id = n - 1, p = 0;
    if (x[id] > y[id]) {
        p = 1;
    }
    while (id >= 0) {
        int nid = (p == 0 ? x[id] : y[id]);
        if (nid >= 0) {
            ans[nid] = p;
        }
        p ^= 1;
        for (int i = nid + 1; i <= id; i++) {
            ans[i] = p;
        }
        id = nid;
    }
    cout << "Yes" << '\n';
    for (int i : ans) {
        cout << i << " ";
    }
    cout << '\n';
    return 0;
}