#include <bits/stdc++.h>
using namespace std;
using itn = int;
const long double PI = 3.141592653589793238;
long long pow(long long x, long long pw) {
  long long res = 1;
  for (; pw; pw >>= 1) {
    if (pw & 1) {
      res *= x;
    }
    x = x * x;
  }
  return res;
}
void NO() {
  cout << "NO";
  exit(0);
}
long long gcd(long long a, long long b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
long long lcd(long long a, long long b) { return a * b / gcd(a, b); }
long long INF = 1000L * 1000L * 1000L + 150L;
long long n;
struct Rect {
  long long x1, x2, y1, y2;
  Rect(long long x1, long long x2, long long y1, long long y2)
      : x1(x1), x2(x2), y1(y1), y2(y2) {}
  bool hor(Rect other) {
    return (x1 == other.x2 || x2 == other.x1) &&
           !(y1 >= other.y2 || other.y1 >= y2);
  }
  bool vert(Rect other) {
    return (y1 == other.y2 || y2 == other.y1) &&
           !(x1 >= other.x2 || other.x1 >= x2);
  }
};
vector<Rect> r;
map<int, vector<int> > X;
map<int, vector<int> > Y;
map<int, int> cX;
map<int, int> cY;
set<int> usedX;
set<int> usedY;
void dfsx(int v, int c) {
  usedX.insert(v);
  cX[v] = c;
  for (int u : X[v]) {
    if (usedX.count(u)) {
      continue;
    }
    dfsx(u, 1 - c);
  }
}
void dfsy(int v, int c) {
  usedY.insert(v);
  cY[v] = c;
  for (int u : Y[v]) {
    if (usedY.count(u)) {
      continue;
    }
    dfsy(u, 1 - c);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    r.emplace_back(x1, x2, y1, y2);
    X.emplace(x1, vector<int>());
    X[x1].push_back(x2);
    X[x2].push_back(x1);
    Y.emplace(y1, vector<int>());
    Y[y1].push_back(y2);
    Y[y2].push_back(y1);
  }
  for (int k = 0; k < n; ++k) {
    int x = r[k].x1;
    if (!usedX.count(x)) {
      dfsx(x, 0);
    }
  }
  for (int k = 0; k < n; ++k) {
    int y = r[k].y1;
    if (!usedY.count(y)) {
      dfsy(y, 0);
    }
  }
  cout << "YES\n";
  for (int j = 0; j < n; ++j) {
    cout << (cX[r[j].x1] + 2 * cY[r[j].y1] + 1) << "\n";
  }
  return 0;
}
