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<algorithm>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<set>
using namespace std;

// #define NDEBUG
#include<cassert>

namespace Elaina{
    #define rep(i, l, r) for(int i=(l), i##_end_=(r); i<=i##_end_; ++i)
    #define drep(i, l, r) for(int i=(l), i##_end_=(r); i>=i##_end_; --i)
    #define fi first
    #define se second
    #define mp(a, b) make_pair(a, b)
    #define Endl putchar('\n')
    #define mmset(a, b) memset(a, b, sizeof a)
    // #define int long long
    typedef long long ll;
    typedef unsigned long long ull;
    typedef pair<int, int> pii;
    typedef pair<ll, ll> pll;
    template<class T>inline T fab(T x){ return x<0? -x: x; }
    template<class T>inline void getmin(T& x, const T rhs){ x=min(x, rhs); }
    template<class T>inline void getmax(T& x, const T rhs){ x=max(x, rhs); }
    template<class T>inline T readin(T x){
        x=0; int f=0; char c;
        while((c=getchar())<'0' || '9'<c) if(c=='-') f=1;
        for(x=(c^48); '0'<=(c=getchar()) && c<='9'; x=(x<<1)+(x<<3)+(c^48));
        return f? -x: x;
    }
    template<class T>inline void writc(T x, char s='\n'){
        static int fwri_sta[1005], fwri_ed=0;
        if(x<0) putchar('-'), x=-x;
        do fwri_sta[++fwri_ed]=x%10, x/=10; while(x);
        while(putchar(fwri_sta[fwri_ed--]^48), fwri_ed);
        putchar(s);
    }
}
using namespace Elaina;

const int maxn=1e5;
const int inf=0x3f3f3f3f;

int k[maxn+5], n;
pii left[maxn+5], right[maxn+5];

/** 
 * @brief the index means now which hand is accepting the new card, 
 * @param first the holding number of the other hand
 * @param second the staring holding point
*/
set<pii>f[2];
int to[maxn+5][2];

inline int inside(int x, pii interval){
    return interval.fi<=x && x<=interval.se;
}

void print(int i, int cur){
    if(!i) return;
    print(to[i][cur], cur^1);
    rep(j, to[i][cur]+1, i) writc(cur, ' ');
}

signed main(){
    n=readin(1), readin(1);
    rep(i, 1, n){
        k[i]=readin(1);
        left[i].fi=readin(1), left[i].se=readin(1);
        right[i].fi=readin(1), right[i].se=readin(1);
    }
    /** special treatment for the first request */
    if(right[1].fi==0 && inside(k[1], left[1]))
        f[0].insert(mp(0, 0));
    if(left[1].fi==0 && inside(k[1], right[1]))
        f[1].insert(mp(0, 0));
    /** from 2 to n */
    rep(i, 2, n){
        /** record the status, because later we'll change it */
        int emp0=f[0].empty(), emp1=f[1].empty();
        if(!emp0) f[1].insert(mp(k[i-1], i-1));
        if(!emp1) f[0].insert(mp(k[i-1], i-1));
        /** try letting left hand hold this card */
        if(inside(k[i], left[i])){
            while(!f[0].empty() && !inside(f[0].begin()->fi, right[i]))
                f[0].erase(f[0].begin());
            while(!f[0].empty() && !inside(f[0].rbegin()->fi, right[i]))
                f[0].erase(f[0].lower_bound(*f[0].rbegin()));
        }
        else f[0].clear(); /** fail to accept */
        if(inside(k[i], right[i])){
            while(!f[1].empty() && !inside(f[1].begin()->fi, left[i]))
                f[1].erase(f[1].begin());
            while(!f[1].empty() && !inside(f[1].rbegin()->fi, left[i]))
                f[1].erase(f[1].lower_bound(*f[1].rbegin()));
        }
        else f[1].clear();
        /** randomly choose a point to be the previous trans point */
        if(!f[0].empty()) to[i][0]=f[0].begin()->se;
        if(!f[1].empty()) to[i][1]=f[1].begin()->se;
    }
    if(!f[0].empty()) printf("yEs\n"), print(n, 0);
    else if(!f[1].empty()) printf("yEs\n"), print(n, 1);
    else printf("nO\n");
    return 0;
}