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;
class point {
 public:
  double x, y;
  point(double x, double y) : x(x), y(y) {}
  point() {}
  double operator^(point other) { return x * other.y - y * other.x; }
  double operator*(point other) { return x * other.x + y * other.y; }
  point operator*(double n) { return point(x * n, y * n); }
  point operator/(double n) { return point(x / n, y / n); }
  point operator-=(point& other) {
    x -= other.x;
    y -= other.y;
    return *this;
  }
  int quadrant() {
    if (x >= 0)
      if (y >= 0)
        return 1;
      else
        return 4;
    else if (y > 0)
      return 2;
    else
      return 3;
  }
  double mo() { return sqrt(x * x + y * y); }
  void read() {
    double x, y;
    scanf("%lf%lf", &x, &y);
    this->x = x;
    this->y = y;
  }
};
point operator-(point ths, point other) {
  return point(ths.x - other.x, ths.y - other.y);
}
point operator+(const point ths, point other) {
  return point(ths.x + other.x, ths.y + other.y);
}
bool operator<(point ths, point other) {
  double cross = other ^ ths;
  int q1 = ths.quadrant();
  int q2 = other.quadrant();
  if (q1 == q2)
    if (-1e-6 < cross && cross < 1e-6)
      return ths.mo() < other.mo();
    else
      return cross < 0;
  else
    return q1 < q2;
}
ostream& operator<<(ostream& os, point p) {
  return os << "(" << fixed << setprecision(1) << p.x << "," << p.y << ")";
}
class convex {
 public:
  set<point> S;
  point center;
  double area;
  void init(point A, point B, point C) {
    S.clear();
    center = (A + B + C) / 3;
    S.insert(A - center);
    S.insert(B - center);
    S.insert(C - center);
    area = abs((A - B) ^ (A - C)) / 2;
  }
  set<point>::iterator nxt(set<point>::iterator it) {
    it++;
    if (it == S.end()) it = S.begin();
    return it;
  }
  set<point>::iterator prv(set<point>::iterator it) {
    if (it == S.begin()) it = S.end();
    it--;
    return it;
  }
  bool judge_out(point P) {
    P = P - center;
    set<point>::iterator up = S.lower_bound(P);
    if (up == S.end()) up = S.begin();
    set<point>::iterator lo = prv(up);
    double calc = ((*up) - (*lo)) ^ (P - (*lo));
    if (calc > 1e-6) return false;
    return true;
  }
  bool judge_in(point P) {
    P = P - center;
    set<point>::iterator up = S.lower_bound(P);
    if (up == S.end()) up = S.begin();
    set<point>::iterator lo = prv(up);
    double calc = ((*up) - (*lo)) ^ (P - (*lo));
    if (calc > -1e-6) return true;
    return false;
  }
  void insert(point P) {
    P = P - center;
    set<point>::iterator up = S.lower_bound(P);
    if (up == S.end()) up = S.begin();
    set<point>::iterator lo = prv(up);
    set<point>::iterator tmp = nxt(up), nx;
    if (false)
      cout << "up:" << ((*up) + center) << "lo:" << ((*lo) + center)
           << ((*tmp) + center) << endl;
    if ((((*up) - (*lo)) ^ (P - (*lo))) >= 0) return;
    while ((((*tmp) - P) ^ ((*up) - P)) >= 0) {
      if (false) cout << (*tmp);
      tmp = nxt(up = tmp);
    }
    tmp = prv(lo);
    while ((((*lo) - P) ^ ((*tmp) - P)) >= 0) tmp = prv(lo = tmp);
    tmp = lo;
    vector<point> should_delete;
    if (false) cout << "ln136\n";
    while (tmp != up) {
      if (tmp != lo) should_delete.push_back(*tmp);
      if (false) cout << "ln141" << ((*tmp) + center) << endl;
      nx = nxt(tmp);
      if (false) cout << "ln143" << ((*nx) + center) << endl;
      area += (((*nx) - P) ^ ((*tmp) - P)) / 2;
      tmp = nxt(tmp);
    }
    for (auto i : should_delete) {
      if (false) cout << "erase" << (i + center);
      S.erase(i);
    }
    S.insert(P);
  }
} conv;
point p[3], tmp;
ostream& operator<<(ostream& os, convex& conv) {
  os << "Convex:area=" << conv.area << "\n";
  for (set<point>::iterator it = conv.S.begin(); it != conv.S.end(); it++)
    os << ((*it) + conv.center);
  os << endl;
  return os;
}
int main() {
  int q, cnt = 0;
  scanf("%d", &q);
  while (q--) {
    int op;
    scanf("%d", &op);
    tmp.read();
    if (op == 1) {
      if (cnt < 3) {
        p[cnt] = tmp;
        cnt += 1;
        if (cnt == 3) conv.init(p[0], p[1], p[2]);
      } else
        conv.insert(tmp);
    } else {
      if (conv.judge_in(tmp))
        printf("YES\n");
      else
        printf("NO\n");
    }
  }
}