One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other.

Help Timofey to color his rectangles in 4 different colors in such a way that every two rectangles touching each other by side would have different color, or determine that it is impossible.

Two rectangles intersect if their intersection has positive area. Two rectangles touch by sides if there is a pair of sides such that their intersection has non-zero length

<image> The picture corresponds to the first example

Input

The first line contains single integer n (1 ≤ n ≤ 5·105) — the number of rectangles.

n lines follow. The i-th of these lines contains four integers x1, y1, x2 and y2 ( - 109 ≤ x1 < x2 ≤ 109,  - 109 ≤ y1 < y2 ≤ 109), that means that points (x1, y1) and (x2, y2) are the coordinates of two opposite corners of the i-th rectangle.

It is guaranteed, that all sides of the rectangles have odd lengths and rectangles don't intersect each other.

Output

Print "NO" in the only line if it is impossible to color the rectangles in 4 different colors in such a way that every two rectangles touching each other by side would have different color.

Otherwise, print "YES" in the first line. Then print n lines, in the i-th of them print single integer ci (1 ≤ ci ≤ 4) — the color of i-th rectangle.

Example

Input

8
0 0 5 3
2 -1 5 0
-3 -4 2 -1
-1 -1 2 0
-3 0 0 5
5 2 10 3
7 -3 10 2
4 -2 7 -1


Output

YES
1
2
2
3
2
2
4
1
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.util.Arrays;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.TreeMap;
import java.io.Writer;
import java.io.BufferedReader;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author ChamathK
 */
public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    FastScanner in = new FastScanner(inputStream);
    FastPrinter out = new FastPrinter(outputStream);
    TaskB solver = new TaskB();
    solver.solve(1, in, out);
    out.close();
  }

  static class TaskB {

    static int[] ch;
    static int[] cv;
    static int[][] hh;
    static int[][] graph;
    static boolean[] vis;

    public void solve(int testNumber, FastScanner in, FastPrinter out) {
      int n = in.nextInt();
      ch = new int[n];
      cv = new int[n];
      hh = new int[5 * n + 20][2];

      TreeMap<Integer, ArrayList<Pair>> xc = new TreeMap<>();
      TreeMap<Integer, ArrayList<Pair>> yc = new TreeMap<>();

      for (int i = 0; i < n; i++) {
        int x1 = in.nextInt();
        int y1 = in.nextInt();
        int x2 = in.nextInt();
        int y2 = in.nextInt();
        Pair yy = new Pair(y1, y2, i);
        Pair xx = new Pair(x1, x2, i);
        add(xc, x1, yy);
        add(xc, x2, yy);
        add(yc, y1, xx);
        add(yc, y2, xx);
      }

      // xc

      xc(xc, n, ch);
      xc(yc, n, cv);

//        Debug.deb(ch);
//        Debug.deb(cv);

      out.println("YES");
      for (int i = 0; i < n; i++) {
        out.println(ch[i] * 2 + cv[i] + 1);
      }


    }

    private void xc(TreeMap<Integer, ArrayList<Pair>> xc, int n, int[] arr) {
      int ct = 0;
      for (ArrayList<Pair> pairs : xc.values()) {
        Collections.sort(pairs);
        Pair cp = null;
        for (Pair pair : pairs) {
          if (cp == null) {
            cp = pair;
            continue;
          }
          if (pair.st < cp.en) {
            hh[ct][0] = cp.id;
            hh[ct][1] = pair.id;
            ct++;
          }

          if (pair.en > cp.en) {
            cp = pair;
          }
        }
      }

      int[] from = new int[ct];
      int[] to = new int[ct];

      for (int i = 0; i < ct; i++) {
        from[i] = hh[i][0];
        to[i] = hh[i][1];
      }

//        System.out.println("-----------------");
//        Debug.deb(from);
//        Debug.deb(to);
//        System.out.println("------------");

      graph = GraphUtils.getEdgesUndirectedUnweighted(n, from, to);
      vis = new boolean[n];
      for (int i = 0; i < n; i++) {
        if (!vis[i]) {
          visit(i, 0, arr);
        }
      }
    }

    void visit(int node, int col, int[] arr) {
      if (vis[node]) {
        return;
      }
      vis[node] = true;
      arr[node] = col;

      for (int nn : graph[node]) {
        visit(nn, 1 - col, arr);
      }

    }

    void add(TreeMap<Integer, ArrayList<Pair>> map, int c, Pair p) {
      if (!map.containsKey(c)) {
        map.put(c, new ArrayList<>());
      }
      map.get(c).add(p);
    }

    class Pair implements Comparable<Pair> {

      int st;
      int en;
      int id;

      public Pair(int st, int en, int id) {
        this.st = st;
        this.en = en;
        this.id = id;
      }


      public int compareTo(Pair o) {
        return this.st - o.st;
      }

    }

  }

  static class GraphUtils {

    public static int[][] getEdgesUndirectedUnweighted(int n, int[] v, int[] u) {
      int[][] edges = new int[n][];
      int[] deg = getDegreeUndirected(n, v, u);
      for (int i = 0; i < n; i++) {
        edges[i] = new int[deg[i]];
      }
      int m = v.length;
      Arrays.fill(deg, 0);
      for (int i = 0; i < m; i++) {
        edges[v[i]][deg[v[i]]++] = u[i];
        edges[u[i]][deg[u[i]]++] = v[i];
      }
      return edges;
    }

    public static int[] getDegreeUndirected(int n, int[] v, int[] u) {
      int[] deg = new int[n];
      for (int i : v) {
        deg[i]++;
      }
      for (int i : u) {
        deg[i]++;
      }
      return deg;
    }

  }

  static class FastPrinter extends PrintWriter {

    public FastPrinter(OutputStream out) {
      super(out);
    }

    public FastPrinter(Writer out) {
      super(out);
    }

  }

  static class FastScanner extends BufferedReader {

    public FastScanner(InputStream is) {
      super(new InputStreamReader(is));
    }


    public int read() {
      try {
        int ret = super.read();
//            if (isEOF && ret < 0) {
//                throw new InputMismatchException();
//            }
//            isEOF = ret == -1;
        return ret;
      } catch (IOException e) {
        throw new InputMismatchException();
      }
    }

    static boolean isWhiteSpace(int c) {
      return c >= 0 && c <= 32;
    }

    public int nextInt() {
      int c = read();
      while (isWhiteSpace(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      int ret = 0;
      while (c >= 0 && !isWhiteSpace(c)) {
        if (c < '0' || c > '9') {
          throw new NumberFormatException("digit expected " + (char) c
              + " found");
        }
        ret = ret * 10 + c - '0';
        c = read();
      }
      return ret * sgn;
    }

    public String readLine() {
      try {
        return super.readLine();
      } catch (IOException e) {
        return null;
      }
    }

  }
}

