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 PI = 3.141592653589793238462643383279502;
struct Point {
  long double x, y;
  long double len2() const { return x * x + y * y; }
  Point() { x = y = 0; }
  Point(long double X, long double Y) {
    x = X;
    y = Y;
  }
};
Point operator+(Point a, Point b) { return Point(a.x + b.x, a.y + b.y); }
Point operator-(Point a, Point b) { return Point(a.x - b.x, a.y - b.y); }
long double operator%(Point a, Point b) { return a.x * b.x + a.y * b.y; }
long double operator*(Point a, Point b) { return a.x * b.y - a.y * b.x; }
long double dist2(Point a, Point b) { return (a - b).len2(); }
long double PolarAngle(long double x, long double y) {
  long double a = atan2(y, x);
  if (a < 0) a += 2 * PI;
  return a;
}
bool operator<(Point a, Point b) {
  if (a * b > 0 || (a * b == 0 && a.len2() < b.len2()))
    return true;
  else
    return false;
}
bool operator==(Point a, Point b) {
  if (a.x == b.x && a.y == b.y)
    return true;
  else
    return false;
}
struct comp {
  bool operator()(const Point &a, const Point &b) const {
    return PolarAngle(a.x, a.y) < PolarAngle(b.x, b.y);
  }
};
bool is_r(Point a, Point b) { return a * b > 0; }
set<Point, comp> st;
Point start;
bool find(long double x, long double y) {
  Point cur = Point(x, y) - start;
  if (cur == Point(0, 0)) return true;
  set<Point, comp>::iterator i = st.lower_bound(cur), j = i;
  Point tmpi, tmpj;
  if (i != st.end()) tmpi = *i;
  if (i == st.end()) {
    i = st.begin();
    j--;
    tmpi = *i;
    tmpj = *j;
    if (is_r(cur - *j, *i - *j))
      return false;
    else
      return true;
  }
  if (j == st.begin()) {
    j = st.end();
    --j;
  } else
    --j;
  tmpj = *j;
  if (is_r(cur - *j, *i - *j))
    return false;
  else
    return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int q, t, x, y;
  cin >> q;
  Point tmp[3];
  for (int i(0); i < 3; ++i) {
    cin >> t >> x >> y;
    tmp[i] = Point(x * 2, y * 2);
  }
  q -= 3;
  Point one;
  one = Point((tmp[0].x + tmp[1].x) / 2, (tmp[0].y + tmp[1].y) / 2);
  start = Point((long double)(one.x + tmp[2].x) / 2,
                (long double)(one.y + tmp[2].y) / 2);
  for (int i(0); i < 3; ++i) st.insert(tmp[i] - start);
  while (q--) {
    cin >> t >> x >> y;
    x *= 2;
    y *= 2;
    bool in = find(x, y);
    if (t == 1) {
      if (in) continue;
      vector<Point> v;
      Point cur = Point(x, y) - start;
      set<Point, comp>::iterator i = st.lower_bound(cur), j = i, pre = i, p = i;
      Point Pre, P, I;
      if (i == st.end()) i = st.begin();
      I = *i;
      pre = p = i;
      p++;
      if (p == st.end()) p = st.begin();
      P = *p;
      Pre = *pre;
      while ((*pre - cur) * (*p - cur) < 0) {
        v.push_back(*pre);
        pre = p;
        p++;
        if (p == st.end()) p = st.begin();
        P = *p;
        Pre = *pre;
      }
      if (i == st.begin()) {
        i = st.end();
        --i;
      } else
        --i;
      pre = p = i;
      if (p == st.begin()) {
        p = st.end();
        --p;
      } else
        --p;
      P = *p;
      Pre = *pre;
      while ((*pre - cur) * (*p - cur) > 0 && st.size() > 2) {
        v.push_back(*pre);
        pre = p;
        if (p == st.begin()) p = st.end();
        p--;
        P = *p;
        Pre = *pre;
      }
      for (int i(0); i < v.size(); ++i) st.erase(v[i]);
      st.insert(cur);
    } else {
      if (in)
        cout << "YES\n";
      else
        cout << "NO\n";
    }
  }
}