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;
const double EPS = 1e-8;
inline int Sig(double x) { return (x > EPS) - (x < -EPS); }
class Point {
 public:
  long long x, y;
  double agl;
  Point() {}
  Point(long long _x, long long _y) : x(_x), y(_y) {}
  bool Read() { return scanf("%I64d%I64d", &x, &y) != EOF; }
  bool operator<(const Point& a) const { return Sig(agl - a.agl) < 0; }
  Point operator+(const Point& a) const { return Point(x + a.x, y + a.y); }
  Point operator-(const Point& a) const { return Point(x - a.x, y - a.y); }
  long long operator^(const Point& a) const { return x * a.y - a.x * y; }
  long long X(Point a, Point b) { return a - *this ^ b - *this; }
};
set<Point> convex;
vector<Point> tgl;
double X, Y;
long long area;
inline bool cmp(Point a, Point b) { return a.x == b.x ? a.y < b.y : a.x < b.x; }
inline double get_angle(Point p) { return atan2(p.y - Y, p.x - X); }
void init() {
  X = 0., Y = 0.;
  if (tgl.size() > 4)
    tgl[3] = tgl[0];
  else
    tgl.push_back(tgl[0]);
  for (int i = 0; i < 3; i++) X += tgl[i].x, Y += tgl[i].y;
  X /= 3.;
  Y /= 3.;
  for (int i = 0; i < 3; i++) {
    tgl[i].agl = get_angle(tgl[i]);
    convex.insert(tgl[i]);
    area += tgl[i] ^ tgl[i + 1];
  }
  if (area < 0) area = -area;
}
set<Point>::iterator last(set<Point>::iterator it) {
  if (it == convex.begin()) it = convex.end();
  return --it;
}
set<Point>::iterator next(set<Point>::iterator it) {
  if (++it == convex.end()) return convex.begin();
  return it;
}
void update(Point p) {
  set<Point>::iterator it = last(convex.lower_bound(p));
  Point a = *it;
  if (a.X(*next(it), p) > 0) return;
  set<Point>::iterator left = it, right = it;
  while (p.X(*next(right), *right) >= 0) right = next(right);
  while (p.X(*left, *last(left)) >= 0) left = last(left);
  it = left;
  while (it != right) area -= *it ^ *next(it), it = next(it);
  it = next(left);
  while (it != right) it = next(it), convex.erase(last(it));
  area += *left ^ p;
  area += p ^ *right;
  convex.insert(p);
}
bool query(Point p) {
  set<Point>::iterator it = last(convex.lower_bound(p));
  Point a = *it;
  if (a.X(*next(it), p) >= 0)
    return 1;
  else
    return 0;
}
int main() {
  Point p;
  int n, a, b, c;
  bool isTgl;
  while (scanf("%d", &n) != EOF) {
    convex.clear();
    tgl.clear();
    area = 0LL;
    isTgl = 0;
    while (n--) {
      scanf("%d", &a);
      p.Read();
      if (a == 1) {
        if (isTgl == 0) {
          if (tgl.size() > 1 && tgl[0].X(tgl[1], p)) {
            isTgl = true;
            sort(tgl.begin(), tgl.end(), cmp);
            tgl[1] = tgl[tgl.size() - 1];
            if (tgl.size() > 3)
              tgl[2] = p;
            else
              tgl.push_back(p);
            init();
          } else
            tgl.push_back(p);
        } else {
          p.agl = get_angle(p);
          update(p);
        }
      } else {
        p.agl = get_angle(p);
        if (query(p))
          puts("YES");
        else
          puts("NO");
      }
    }
  }
  return 0;
}