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>

using namespace std;

using pii = pair<int, int>;

bool verify_solush(const vector<int>& k, const vector<array<pii, 2>>& range_bounds, const vector<bool>& solush) {
  int n = k.size();
  array<int, 2> cur{0, 0};
  for (int i = 0; i < n; ++i) {
    cur[solush[i] ? 1 : 0] = k[i];
    for (int j = 0; j < 2; ++j) {
      if (cur[j] < range_bounds[i][j].first) {
	return false;
      }
      if (cur[j] > range_bounds[i][j].second) {
	return false;
      }
    }
  }
  return true;
}

pii overlap(const pii& x, const pii& y) {
  return {max(x.first, y.first), min(x.second, y.second)};
}

bool within(const pii& p, int k) {
  return (k >= p.first) && (k <= p.second);
}

void add_constraint(vector<array<pii, 2>>& cons, const array<pii, 2>& newco) {
  int n = cons.size();
  for (int i = 0; i < n; ++i) {
    array<pii, 2> ov{overlap(cons[i][0], newco[0]), overlap(cons[i][1], newco[1])};
    if (ov == newco) {
      return;
    }
    if (ov == cons[i]) {
      cons[i] = newco;
      return;
    }
  }
  cons.push_back(newco);
}

bool both_within(const array<pii, 2>& co, const array<int, 2>& nums) {
  return within(co[0], nums[0]) && within(co[1], nums[1]);
}

bool any_within(const vector<array<pii, 2>>& cons, const array<int, 2>& nums) {
  for (const array<pii, 2>& co : cons) {
    if (both_within(co, nums)) {
      return true;
    }
  }
  return false;
}

vector<bool> solve(int m, const vector<int>& k, const vector<array<pii, 2>>& range_bounds) {
  int n = k.size();
  vector<vector<array<pii, 2>>> dp(n+1);
  const pii NOCO(0, m);
  dp[n].push_back({NOCO, NOCO});
  for (int i = n-1; i >= 0; --i) {
    for (const array<pii, 2>& co : dp[i+1]) {
      array<pii, 2> newco{overlap(range_bounds[i][0], co[0]), overlap(range_bounds[i][1], co[1])};
      for (int j = 0; j < 2; ++j) {
	if (within(newco[j], k[i])) {
	  array<pii, 2> newco2 = newco;
	  newco2[j] = NOCO;
	  add_constraint(dp[i], newco2);
	}
      }
    }
    if (dp[i].empty()) {
      return {};
    }
    assert(int(dp[i].size()) <= 2);
  }
  array<int, 2> nums{0, 0};
  if (!any_within(dp[0], nums)) {
    return {};
  }
  vector<bool> solush(n);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 2; ++j) {
      array<int, 2> nextnums = nums;
      nextnums[j] = k[i];
      if (both_within(range_bounds[i], nextnums) && any_within(dp[i+1], nextnums)) {
	solush[i] = (j == 1);
	nextnums.swap(nums);
	break;
      }
    }
  }
  return solush;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  vector<int> k(n);
  vector<array<pii, 2>> range_bounds(n);
  for (int i = 0; i < n; ++i) {
    cin >> k[i] >> range_bounds[i][0].first >> range_bounds[i][0].second >> range_bounds[i][1].first >> range_bounds[i][1].second;
  }
  vector<bool> solush = solve(m, k, range_bounds);
  if (solush.empty()) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  for (int i = 0; i < n; ++i) {
    if (i > 0) cout << " ";
    cout << (solush[i] ? "1" : "0");
  }
  cout << endl;
  assert(verify_solush(k, range_bounds, solush));
}