#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> k(n), al(n), bl(n), ar(n), br(n), ans, cl(n + 1), dl(n + 1), cr(n + 1), dr(n + 1);
    for (int i = 0; i < n; i ++ ) cin >> k[i] >> al[i] >> bl[i] >> ar[i] >> br[i];
    cl[n] = 0, dl[n] = m, cr[n] = 0, dr[n] = m;
    for (int i = n - 1; ~i; i -- )
	{
        cl[i] = m + 1, dl[i] = 0, cr[i] = m + 1, dr[i] = 0;
        if (al[i] <= k[i] && k[i] <= bl[i])
            if (cl[i + 1] <= k[i] && k[i] <= dl[i + 1]) cr[i] = ar[i], dr[i] = br[i];
            else cr[i] = max(ar[i], cr[i + 1]), dr[i] = min(br[i], dr[i + 1]);
        if (ar[i] <= k[i] && k[i] <= br[i])
            if (cr[i + 1] <= k[i] && k[i] <= dr[i + 1]) cl[i] = al[i], dl[i] = bl[i];
            else cl[i] = max(al[i], cl[i + 1]), dl[i] = min(bl[i], dl[i + 1]);
    }
    if ((cl[0] <= 0 && 0 <= dl[0]) || (cr[0] <= 0 && 0 <= dr[0]))
	{
    	puts("Yes");
        int x = 0, y = 0;
        for (int i = 0; i < n; i ++ )
            if (al[i] <= k[i] && k[i] <= bl[i] && ar[i] <= y && y <= br[i] && ((cl[i + 1] <= k[i] && k[i] <= dl[i + 1]) || (cr[i + 1] <= y && y <= dr[i + 1]))) {x = k[i]; cout << 0 << " \n"[i == n - 1]; }
    		else if (al[i] <= x && x <= bl[i] && ar[i] <= k[i] && k[i] <= br[i] && ((cl[i + 1] <= x && x <= dl[i + 1]) || (cr[i + 1] <= k[i] && k[i] <= dr[i + 1]))) {y = k[i]; std::cout << 1 << " \n"[i == n - 1]; }
    }
	else puts("No");
	
    return 0;
}