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>
#define ll long long
#define loop(i, a, b) for(ll i=a;i<b;++i)
#define pool(i, a, b) for(ll i=a-1;i>=b;--i)
#define fore(i, a) for(auto&& i:a)
#define fi first
#define se second
#define ps(a) push_back(a)
#define pb(a) pop_back(a)
#define eb(...) emplace_back(__VA_ARGS__)
#define sc scanf
#define vc vector
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(), a.end()
#define llmax LLONG_MAX/2
#define llmin -LLONG_MAX/2
using namespace std;
#define mn 500100
#define par pair<ll, ll>
#define ld long double
#define mod 1000000007
 
int main() {
    ll n, m;cin >> n >> m;
    
    set<par> l, r;
    l.insert(make_pair(0, -1));
    r.insert(make_pair(0, -1));
    
    function<set<par>::iterator ()> zadl=[&](){
        auto ret=l.end();ret--;
        return ret;
    };
    function<set<par>::iterator ()> zadr=[&](){
        auto ret=r.end();ret--;
        return ret;
    };
    
    vc<ll> ans(n, -1);
    vc<vc<ll>> pre(2, vc<ll> (n, -1));
    
    loop(i, 0, n){
        ll k;cin >> k;
        ll l1, r1, l2, r2;cin >> l1 >> r1 >> l2 >> r2;
        
        while(l.size() and (l.begin()->fi < l1 or l.begin()->fi > r1)) l.erase(l.begin());
        while(r.size() and (r.begin()->fi < l2 or r.begin()->fi > r2)) r.erase(r.begin());
        while(l.size() and (zadl()->fi < l1 or zadl()->fi > r1)) l.erase(zadl());
        while(r.size() and (zadr()->fi < l2 or zadr()->fi > r2)) r.erase(zadr());
        
        par f1=make_pair((ll)-1, (ll)-1), f2=make_pair((ll)-1, (ll)-1);
        
        if(l1<=k and k<=r1 and r.size()) ans[i]=0, pre[0][i]=r.begin()->se, f1=make_pair(k, i);
        else r.clear();
        if(l2<=k and k<=r2 and l.size()) ans[i]=1, pre[1][i]=l.begin()->se, f2=make_pair(k, i);
        else l.clear();
        
        if(f1!=make_pair((ll)-1, (ll)-1)) l.insert(f1);
        if(f2!=make_pair((ll)-1, (ll)-1)) r.insert(f2);
    }
    
    if(ans[n-1]==-1) cout << "No"<<endl;
    else{
        cout << "Yes"<<endl;
        
        vc<ll> fans(n);
        ll cur=n-1, katir=ans[n-1];
        while(cur>=0){
            loop(i, pre[katir][cur]+1, cur+1) fans[i]=katir;
            cur=pre[katir][cur];
            katir= !katir;
        }
        
        loop(i, 0, n) cout << fans[i]<<" ";cout <<endl;
    }
}