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:
///100gods

#include <bits/stdc++.h>
#define int long long
#define vec2 vector<vector<int>>
#define fio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define FRE freopen("elegant.in","r",stdin);freopen("elegant.out","w",stdout)
#define pii pair <int,int>
#define vii vector <int>
#define vpii vector <pii>
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define minii LLONG_MAX
#define all(x) x.begin(), x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define double long double
#define eb emplace_back
const double pi = 3.1415926535898;
const int mod=1e9+7;
//const int mod=998244353;

using namespace std;

int32_t main()
{
    fio;
    int n,m,k,lr,ll,rr,rl;
    cin>>n>>m;
    int dp[n+2][2];
    dp[0][0]=dp[1][1]=1;
    set <pair<int,int>> left,right,leftrev,rightrev;
    left.insert({0,0});
    right.insert({0,0});
    leftrev.insert({0,0});
    rightrev.insert({0,0});
    int failR = -1, failL = -1;
    for (int i=1;i<=n;i++)
    {
        cin>>k;
        cin>>ll>>lr>>rl>>rr;
        dp[i][0]=dp[i][1]=-1;
        if(k < ll || k > lr)
            failL = i;
        if(k < rl || k > rr)
            failR = i;
        while (left.size())
        {
            auto it=left.begin();
            if (it->ff>=ll)
            {
                break;
            }
            leftrev.erase({it->ss,it->ff});
            left.erase(it);
        }
        while (left.size())
        {
            auto it=left.end();
            it--;
            if (it->ff<=lr)
            {
                break;
            }
            leftrev.erase({it->ss,it->ff});
            left.erase(it);
        }

        while (right.size())
        {
            auto it=right.begin();
            if (it->ff>=rl)
            {
                break;
            }
            rightrev.erase({it->ss,it->ff});
            right.erase(it);
        }
        while (right.size())
        {
            auto it=right.end();
            it--;
            if (it->ff<=rr)
            {
                break;
            }
            rightrev.erase({it->ss,it->ff});
            right.erase(it);
        }

        if (left.size())
        {
            auto it=leftrev.end();
            it--;
            if (failR<=it->ff)
            {
                dp[i][1]=i-it->ff;
            }
        }
        if (right.size())
        {
            auto it=rightrev.end();
            it--;
            if (failL<=it->ff)
            {
                dp[i][0]=i-it->ff;
            }
        }
        if (dp[i][1]!=-1)
        {
            right.insert({k,i});
            rightrev.insert({i,k});
        }
        if (dp[i][0]!=-1)
        {
            left.insert({k,i});
            leftrev.insert({i,k});
        }
    }
    if (dp[n][0]==-1&&dp[n][1]==-1)
    {
        cout<<"No\n";
        exit(0);
    }
    cout<<"Yes\n";
    int f=0,x=n;
    if (dp[n][1]!=-1)
    {
        f=1;
    }
    vii ans;
    while (x)
    {
        for (int i=0;i<dp[x][f];i++)
        {
            ans.pb(f);
        }
        x-=dp[x][f];
        f=1-f;
    }
    reverse(all(ans));
    for (auto i:ans)
    {
        cout<<i<<" ";
    }
    return 0;
}