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 JAVA):

Solution:
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.util.Arrays.sort;
import static java.util.Collections.reverse;
import static java.util.Collections.sort;
import static java.util.Comparator.comparingLong;

public class Current {
    FastScanner in;
    PrintWriter out;

    private void solve() throws IOException {
        // solveA();
        // solveB();
        // solveC();
        // solveD();
        solveE();
        // solveF();
    }

    private void solveA() throws IOException {
        int k = in.nextInt();
        while (k-- > 0) {
            long n = in.nextLong(), x = in.nextLong(), t = in.nextLong();
            long cnt = min(n, t / x);
            out.println(cnt * (n - cnt) + (cnt - 1) * cnt / 2);
        }
    }

    private void solveB() throws IOException {
        int n = in.nextInt(), q = in.nextInt();
        char[] s = in.next().toCharArray();
        for (int i = 0; i < n; i++)
            s[i] -= 'a';

        int alpha = 'z' - 'a' + 1;
        long[][] pref = new long[alpha][n];
        pref[s[0]][0]++;
        for (int i = 1; i < n; i++) {
            for (int a = 0; a < alpha; a++)
                pref[a][i] = pref[a][i - 1];
            pref[s[i]][i]++;
        }

        while (q-- > 0) {
            int l = in.nextInt() - 1, r = in.nextInt() - 1;
            long ans = 0;
            for (int a = 0; a < alpha; a++)
                ans += (pref[a][r] - (l == 0 ? 0 : pref[a][l - 1])) * (a + 1);
            out.println(ans);
        }
    }

    void shuffle(long[] a) {
        Random random = new Random();
        for (int i = a.length - 1; i > 0; i--) {
            int j = random.nextInt(i + 1);
            long swap = a[j];
            a[j] = a[i];
            a[i] = swap;
        }
    }

    private void solveC() throws IOException {
        int n = in.nextInt();
        long k = in.nextLong(), x = in.nextLong();
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = in.nextLong();

        shuffle(a);
        sort(a);

        ArrayList<Long> diff = new ArrayList<>();
        for (int i = 0; i < n - 1; i++)
            if (a[i + 1] - a[i] > x)
                diff.add((a[i + 1] - a[i] - 1) / x);

        sort(diff);

        int ans = diff.size() + 1;
        for (long d : diff)
            if (d <= k) {
                k -= d;
                ans--;
            } else
                break;

        out.println(ans);
    }

    class Pair {
        long a, b;

        Pair(long a, long b) {
            this.a = a;
            this.b = b;
        }
    }

    private void solveD() throws IOException {
        int n = in.nextInt();
        Pair[] p = new Pair[n];
        for (int i = 0; i < n; i++)
            p[i] = new Pair(in.nextLong(), in.nextLong());

        sort(p, comparingLong(o -> -o.b));

        long bought = 0, ans = 0;
        for (int l = 0, r = n - 1; l < n; l++) {
            while (p[l].a > 0) {
                long add = min(max(0, p[r].b - bought), p[l].a);
                bought += add;
                ans += add * 2;
                p[l].a -= add;
                while (r >= 0 && p[r].b <= bought) {
                    bought += p[r].a;
                    ans += p[r].a;
                    p[r].a = 0;
                    r--;
                }
            }
        }

        out.println(ans);
    }

    class CardPair {
        int left, right;

        CardPair(int left, int right) {
            this.left = left;
            this.right = right;
        }
    }

    int[] bonus(int[] card, int[] min, int[] max) {
        int[] bonus = new int[card.length];
        int[] stackMin = new int[card.length], stackMax = new int[card.length];
        int sizeMin = 0, sizeMax = 0;

        for (int i = card.length - 1; i >= 0; i--) {
            while (sizeMin > 0 && min[stackMin[sizeMin - 1]] <= min[i])
                sizeMin--;
            stackMin[sizeMin++] = i;
            while (sizeMax > 0 && max[stackMax[sizeMax - 1]] >= max[i])
                sizeMax--;
            stackMax[sizeMax++] = i;

            bonus[i] = card.length;
            int l = -1, r = sizeMin;
            while (l + 1 < r) {
                int m = (l + r) / 2;
                if (min[stackMin[m]] <= card[i])
                    r = m;
                else
                    l = m;
            }
            if (l >= 0 && stackMin[l] < bonus[i])
                bonus[i] = stackMin[l];

            l = -1;
            r = sizeMax;
            while (l + 1 < r) {
                int m = (l + r) / 2;
                if (max[stackMax[m]] >= card[i])
                    r = m;
                else
                    l = m;
            }
            if (l >= 0 && stackMax[l] < bonus[i])
                bonus[i] = stackMax[l];
        }

        return bonus;
    }

    private void solveE() throws IOException {
        int cardCnt = in.nextInt() + 1;
        in.next();
        int[] card = new int[cardCnt];
        int[] leftMin = new int[cardCnt], leftMax = new int[cardCnt];
        int[] rightMin = new int[cardCnt], rightMax = new int[cardCnt];
        for (int i = 1; i < cardCnt; i++) {
            card[i] = in.nextInt();
            leftMin[i] = in.nextInt();
            leftMax[i] = in.nextInt();
            rightMin[i] = in.nextInt();
            rightMax[i] = in.nextInt();
        }

        int[] bonusLeft = bonus(card, leftMin, leftMax);
        int[] bonusRight = bonus(card, rightMin, rightMax);

        // out.println(Arrays.toString(bonusLeft));
        // out.println(Arrays.toString(bonusRight));

        CardPair[][] bestPair = new CardPair[2][cardCnt];
        bestPair[0][0] = new CardPair(0, 0);
        bestPair[1][0] = new CardPair(0, 0);

        for (int i = 1; i < cardCnt; i++) {
            bestPair[0][i] = new CardPair(
                    bonusLeft[bestPair[0][i - 1].left] > bonusLeft[bestPair[1][i - 1].left] ?
                            bestPair[0][i - 1].left :
                            bestPair[1][i - 1].left,
                    i);

            bestPair[1][i] = new CardPair(
                    i,
                    bonusRight[bestPair[0][i - 1].right] > bonusRight[bestPair[1][i - 1].right] ?
                            bestPair[0][i - 1].right :
                            bestPair[1][i - 1].right);

            if (min(bonusLeft[bestPair[0][i].left], bonusRight[bestPair[0][i].right]) == i)
                bestPair[0][i] = bestPair[1][i];
            if (min(bonusLeft[bestPair[1][i].left], bonusRight[bestPair[1][i].right]) == i)
                bestPair[1][i] = bestPair[0][i];

            if (min(bonusLeft[bestPair[0][i].left], bonusRight[bestPair[0][i].right]) == i) {
                out.println("No");
                return;
            }
        }

        out.println("Yes");
        ArrayList<Integer> ans = new ArrayList<>();
        int type = 0;
        for (int i = cardCnt - 1; i > 0; ) {
            boolean found = false;
            for (int j = 0; j < 2 && !found; j++) {
                if (bestPair[type][i].left == bestPair[j][i - 1].left
                        && bestPair[type][i].right != bestPair[j][i - 1].right
                        && bestPair[type][i].right == i) {
                    type = j;
                    i--;
                    ans.add(1);
                    found = true;
                }
                if (!found && bestPair[type][i].right == bestPair[j][i - 1].right
                        && bestPair[type][i].left != bestPair[j][i - 1].left
                        && bestPair[type][i].left == i) {
                    type = j;
                    i--;
                    ans.add(0);
                    found = true;
                }
            }

            if (!found)
                cardCnt = 1 / 0;
        }

        reverse(ans);
        for (int i : ans)
            out.print(i + " ");
    }

    private void solveF() {

    }

    class FastScanner {
        StringTokenizer st;
        BufferedReader br;

        FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }
    }

    private void run() throws IOException {
        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.flush();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Current().run();
    }
}