Problem: Once a walrus professor Plato asked his programming students to perform the following practical task. 

The students had to implement such a data structure that would support a convex hull on some set of points S. The input to the program had q queries of two types: 

1. Add a point with coordinates (x, y) into the set S. Note that in this case the convex hull of S could have changed, and could have remained the same. 

2. Say whether a point with coordinates (x, y) belongs to an area limited by the convex hull, including the border. 

All the students coped with the task. What about you?

Input

The first line contains an integer q (4 ≤ q ≤ 105). 

Then follow q lines in the following way: "t x y", where t is the query type (1 or 2), and (x, y) are the coordinates of the point ( - 106 ≤ x, y ≤ 106, x and y are integers). 

There is at least one query of type 2.

It is guaranteed that the three queries of the first type follow first and the points given in the queries form a non-degenerative triangle. Also all the points added in S are distinct.

Output

For each query of the second type print one string containing "YES", if the point lies inside the convex hull or on its border. Otherwise, print "NO".

Examples

Input

8
1 0 0
1 2 0
1 2 2
2 1 0
1 0 2
2 1 1
2 2 1
2 20 -1


Output

YES
YES
YES
NO

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
struct P {
  long long x, y;
} base;
vector<P> R(200007), p;
int Sg(P p, P q, P r) {
  long long v = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
  return v ? v > 0 ? 1 : 2 : 0;
}
long long D(P a, P b) {
  return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
}
bool cmp(P a, P b) { return a.x ^ b.x ? a.x < b.x : a.y < b.y; }
void bord() {
  int k = 0, n = p.size();
  sort(p.begin(), p.end(), cmp);
  for (int i = 0; i < n; i++) {
    while (k > 1 && Sg(R[k - 2], R[k - 1], p[i]) ^ 2) k--;
    R[k++] = p[i];
  }
  int t = k;
  for (int i = n - 2; i >= 0; i--) {
    while (k > t && Sg(R[k - 2], R[k - 1], p[i]) ^ 2) k--;
    R[k++] = p[i];
  }
  R.resize(k - 1);
}
bool inside(P a, int type) {
  int n = R.size();
  int L = 1, H = n - 1;
  while (H - L > 1) {
    int m = (L + H) / 2;
    if (Sg(R[0], R[m], a) ^ 1)
      L = m;
    else
      H = m;
  }
  int v1 = Sg(R[0], R[L], a), v2 = Sg(R[L], R[H], a), v3 = Sg(R[H], R[0], a);
  if (v1 == 1) v1 = -1;
  if (v2 == 1) v2 = -1;
  if (v3 == 1) v3 = -1;
  return !(v1 * v2 < 0 || v2 * v3 < 0 || v3 * v1 < 0);
}
void add(P a, vector<P> H) {
  int I = 0, n = H.size();
  long long pt = 1e18;
  for (int i = 0; i < n; i++) {
    long long d = D(a, H[i]);
    if (d < pt) pt = d, I = i;
  }
  int u = I;
  bool G = 0;
  while (Sg(a, H[u], H[(u + 1) % n]) ^ 2) u = (u + 1) % n, G = 1;
  if (!G) {
    while (Sg(a, H[u], H[(n + u - 1) % n]) ^ 2) u = (n + u - 1) % n;
  }
  G = 0;
  int L = I;
  while (Sg(a, H[L], H[(n + L - 1) % n]) ^ 1) L = (n + L - 1) % n, G = 1;
  if (!G) {
    while (Sg(a, H[L], H[(L + 1) % n]) ^ 1) L = (L + 1) % n, G = 1;
  }
  int Cr = u;
  if (u == L) Cr = 0, L = n - 1, u = 0;
  R.resize(0);
  R.push_back(H[u]);
  while (Cr ^ L) {
    Cr = (Cr + 1) % n;
    R.push_back(H[Cr]);
  }
  R.push_back(a);
}
int main() {
  int q;
  bool first = 1;
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    long long t;
    P b;
    scanf("%lld %lld %lld", &t, &b.x, &b.y);
    if (t == 1) {
      if (first)
        p.push_back(b);
      else if (!inside(b, 1)) {
        add(b, R);
      }
    } else {
      if (first) {
        first = 0;
        base = p[0];
        bord();
      }
      if (inside(b, 2))
        printf("YES\n");
      else
        printf("NO\n");
    }
  }
}