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 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);
    }
}