#include <bits/stdc++.h>
#define PII pair<int,int>
#define F first
#define S second
using namespace std;
const int N=100005;
int n,m,k[N],tv[N][3];
int nextl[N],nextr[N];
int al[N][20],bl[N][20];
int ar[N][20],br[N][20];
set<int> sl,sr;
vector<int> vl[N],vr[N];
int findl(int i) {
    int L=0,R=1e9;
    int val=k[i];
    for (int j=16;j>=0;j--) {
        if (i+(1<<j)>n+1) continue;
        if (max(L,al[i][j])>val) continue;
        if (min(R,bl[i][j])<val) continue;
        L=max(L,al[i][j]);
        R=min(R,bl[i][j]);
        i+=(1<<j);
    }
    return i-1;
}
int findr(int i) {
    int L=0,R=1e9;
    int val=k[i];
    for (int j=16;j>=0;j--) {
        if (i+(1<<j)>n+1) continue;
        if (max(L,ar[i][j])>val) continue;
        if (min(R,br[i][j])<val) continue;
        L=max(L,ar[i][j]);
        R=min(R,br[i][j]);
        i+=(1<<j);
    }
    return i-1;
}
void quaylui(int i,int tt) {
    if (i==0) return;
    quaylui(tv[i][tt],1-tt);
    for (int j=tv[i][tt]+1;j<=i;j++) cout<<tt<<" ";
}
int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
   
    cin>>n>>m;
    for (int i=1;i<=n;i++) {
        cin>>k[i];
        cin>>al[i][0]>>bl[i][0];
        cin>>ar[i][0]>>br[i][0];
    }
    for (int i=1;i<=16;i++)
    for (int j=0;j<=n;j++)
    if (j+(1<<i)<=n+1) {
        al[j][i]=max(al[j][i-1],al[j+(1<<(i-1))][i-1]);
        ar[j][i]=max(ar[j][i-1],ar[j+(1<<(i-1))][i-1]);
        bl[j][i]=min(bl[j][i-1],bl[j+(1<<(i-1))][i-1]);
        br[j][i]=min(br[j][i-1],br[j+(1<<(i-1))][i-1]);
    }
    memset(tv,-1,sizeof(tv));
    for (int i=n;i>=1;i--) {
        if (k[i]>bl[i][0]||k[i]<al[i][0]) nextl[i-1]=-1;
        else nextl[i-1]=max(i,nextl[i]);
        if (k[i]>br[i][0]||k[i]<ar[i][0]) nextr[i-1]=-1;
        else nextr[i-1]=max(i,nextr[i]);
        //cout<<i-1<<" "<<nextl[i-1]<<" "<<nextr[i-1]<<" "<<findl(i-1)<<" "<<findr(i-1)<<"\n";
    }
    for (int i=0;i<n;i++) {
        nextl[i]=min(nextl[i],findr(i));
        nextr[i]=min(nextr[i],findl(i));
    }
    //cout<<findl(2)<<"\n";
    //for (int i=0;i<n;i++) cout<<i<<" "<<nextl[i]<<" "<<nextr[i]<<"\n";
    for (int i=0;i<=n;i++) {
        for (auto j:vl[i]) sl.erase(j);
        for (auto j:vr[i]) sr.erase(j);
        if (i>0&&sl.empty()&&sr.empty()) break;
        if (!sl.empty()) tv[i][0]=*sl.begin();
        if (!sr.empty()) tv[i][1]=*sr.begin();
        //cout<<i<<" "<<tv[i][0]<<" "<<tv[i][1]<<"\n";
        if (i==n) break;
        if ((tv[i][0]>=0||i==0)&&nextr[i]>i) {
            //cout<<i<<"\n";
            sr.insert(i);
            vr[nextr[i]+1].push_back(i);
        }
        if ((tv[i][1]>=0||i==0)&&nextl[i]>i) {
            //cout<<i<<"\n";
            sl.insert(i);
            vl[nextl[i]+1].push_back(i);
        }
    }
    if (tv[n][0]==-1&&tv[n][1]==-1) cout<<"No";
    else {
        cout<<"Yes\n";
        if (tv[n][0]>=0) quaylui(n,0);
        else quaylui(n,1);
    }
}
