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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> piipi;
typedef pair<pii, pii> piipii;

#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define eb emplace_back

int k[100005], a[100005], b[100005], c[100005], d[100005];
int dpl[100005], dpr[100005];
int main(){
    int n, m;
    scanf("%d%d", &n, &m);
    set<pii> msl, msr;
    msl.insert(mp(0, 0));
    msr.insert(mp(0, 0));

    memset(dpl, -1, sizeof(dpl));
    memset(dpr, -1, sizeof(dpr));
    for(int i=1;i<=n;i++){
        scanf("%d", &k[i]);
        scanf("%d%d", &a[i], &b[i]);
        scanf("%d%d", &c[i], &d[i]);
        while(!msl.empty()){
            auto it = msl.begin();
            if(!(c[i] <= k[it->se] && k[it->se] <= d[i])) msl.erase(msl.begin());
            else break;
        }
        while(!msl.empty()){
            auto it = msl.rbegin();
            if(!(c[i] <= k[it->se] && k[it->se] <= d[i])) msl.erase(--msl.end());
            else break;
        }
        if(c[i] <= k[i-1] && k[i-1] <= d[i] && dpr[i-1] != -1) msl.insert(mp(k[i-1], i-1));

        while(!msr.empty()){
            auto it = msr.begin();
            if(!(a[i] <= k[it->se] && k[it->se] <= b[i])) msr.erase(msr.begin());
            else break;
        }
        while(!msr.empty()){
            auto it = msr.rbegin();
            if(!(a[i] <= k[it->se] && k[it->se] <= b[i])) msr.erase(--msr.end());
            else break;
        }
        if(a[i] <= k[i-1] && k[i-1] <= b[i] && dpl[i-1] != -1) msr.insert(mp(k[i-1], i-1));

        if(!(a[i] <= k[i] && k[i] <= b[i])) msl.clear();
        if(!(c[i] <= k[i] && k[i] <= d[i])) msr.clear();
        if(!msl.empty()) dpl[i] = msl.begin()->se;
        if(!msr.empty()) dpr[i] = msr.begin()->se;
    }
    if(dpl[n] != -1 || dpr[n] != -1){
        printf("Yes\n");
 
        bool L = 0;
        if(dpl[n] != -1) L = 1;
 
        int cur = n;
        vector<int> ans;
        while(cur != 0){
            if(L){
                for(int j=cur;j>dpl[cur];j--) ans.eb(0);
                cur = dpl[cur];
                L ^= 1;
            }
            else{
                for(int j=cur;j>dpr[cur];j--) ans.eb(1);
                cur = dpr[cur];
                L ^= 1;
            }
        }
        reverse(all(ans));
        for(int i=0;i<sz(ans);i++) printf("%d ", ans[i]);
        printf("\n");
    }
    else printf("No\n");
}