#include <bits/stdc++.h>
using namespace std;
struct rect {
  int x1, y1, x2, y2;
  int id;
  rect() {}
  rect(int x1, int y1, int x2, int y2, int id)
      : x1(x1), y1(y1), x2(x2), y2(y2), id(id) {}
  bool intersects(const rect& oth) {
    if (max(x1, oth.x1) == min(x2, oth.x2))
      return max(y1, oth.y1) < min(y2, oth.y2);
    return max(y1, oth.y1) <= min(y2, oth.y2);
  }
  bool operator<(const rect& oth) const {
    if (y1 != oth.y1) return y1 < oth.y1;
    if (y2 != oth.y2) return y2 < oth.y2;
    return id < oth.id;
  }
};
struct ev {
  int x, id;
  bool rem;
  ev(int _x, int _id, bool _rem) : x(_x), id(_id), rem(_rem) {}
  bool operator<(const ev& a) const {
    if (x != a.x) return x < a.x;
    if (rem != a.rem) return rem < a.rem;
    return id < a.id;
  }
};
void color(const vector<vector<int> >& G, vector<bool>& vis, vector<int>& col,
           int v) {
  vis[v] = true;
  for (int i = 0; i < (int)G[v].size(); i++) {
    if (vis[G[v][i]]) continue;
    col[G[v][i]] = 1 - col[v];
    color(G, vis, col, G[v][i]);
  }
}
int main() {
  int N;
  scanf("%d", &N);
  vector<rect> R(N);
  vector<ev> E;
  vector<vector<int> > G(N);
  vector<vector<int> > H(N);
  for (int i = 0; i < N; i++) {
    scanf("%d %d %d %d", &R[i].x1, &R[i].y1, &R[i].x2, &R[i].y2);
    R[i].id = i;
    E.emplace_back(R[i].x1, i, false);
    E.emplace_back(R[i].x2, i, true);
  }
  sort(E.begin(), E.end());
  set<rect> in;
  for (ev e : E) {
    if (e.rem) {
      in.erase(R[e.id]);
    } else {
      rect cur = R[e.id];
      rect Q(0, cur.y2, 0, 1000000001, 0);
      auto it = in.lower_bound(Q);
      while (!in.empty()) {
        if (it == in.end()) --it;
        if (cur.intersects(*it)) {
          if (cur.x1 == it->x2) {
            G[cur.id].push_back(it->id);
            G[it->id].push_back(cur.id);
          } else {
            H[cur.id].push_back(it->id);
            H[it->id].push_back(cur.id);
          }
        }
        if (it->y2 < cur.y1) break;
        if (it == in.begin()) break;
        --it;
      }
      in.insert(cur);
    }
  }
  vector<int> col1(N, 0);
  vector<int> col2(N, 0);
  vector<bool> vis1(N, false);
  vector<bool> vis2(N, false);
  printf("YES\n");
  for (int i = 0; i < N; i++) {
    if (!vis1[i]) color(G, vis1, col1, i);
    if (!vis2[i]) color(H, vis2, col2, i);
    printf("%d\n", 2 * col1[i] + col2[i] + 1);
  }
  return 0;
}
