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 = acos(-1.0);
double fRand(double fMin, double fMax) {
  double f = (double)rand() / RAND_MAX;
  return fMin + f * (fMax - fMin);
}
template <class T>
T min(T a, T b, T c) {
  return min(a, min(b, c));
}
template <class T>
T max(T a, T b, T c) {
  return max(a, max(b, c));
}
struct pt {
  long long x, y;
  int id;
  pt operator+(pt p) { return {x + p.x, y + p.y}; }
  pt operator-(pt p) { return {x - p.x, y - p.y}; }
  pt operator*(long long k) { return {x * k, y * k}; }
  pt operator/(long long k) { return {x / k, y / k}; }
  long long operator*(pt p) { return x * p.y - y * p.x; }
  long long operator%(pt p) { return x * p.x + y * p.y; }
  friend istream& operator>>(istream& is, pt& p) {
    is >> p.x >> p.y;
    return is;
  }
  friend ostream& operator<<(ostream& os, const pt& p) {
    os << p.id << "-(" << p.x << ", " << p.y << ")";
    return os;
  }
};
long long sq(pt p) { return p.x * p.x + p.y * p.y; }
bool half(pt p) { return (p.y > 0 || (p.y == 0 && p.x < 0)); }
struct cmpPt {
  bool operator()(pt v, pt w) {
    return make_tuple(half(v), 0, sq(v)) < make_tuple(half(w), v * w, sq(w));
  }
};
set<pt, cmpPt> s;
pt piv;
set<pt>::iterator nextCir(set<pt>::iterator it, int k = 1) {
  for (int i = 0; i < k; ++i) {
    ++it;
    if (it == s.end()) it = s.begin();
  }
  return it;
}
set<pt>::iterator prevCir(set<pt>::iterator it, int k = 1) {
  for (int i = 0; i < k; ++i) {
    if (it == s.begin()) it = s.end();
    --it;
  }
  return it;
}
long long orient(pt a, pt b, pt c) { return (b - a) * (c - a); }
bool half(pt a, pt p) { return a * p >= 0; }
bool crossesRay(pt a, pt p, pt q) {
  return (half(a, q) - half(a, p)) * orient(a, p, q) > 0;
}
bool onSegment(pt p, pt a, pt b) {
  return orient(p, a, b) == 0 && (a - p) % (b - p) <= 0;
}
bool isIn(pt a) {
  if (a.x == 0 && a.y == 0) return true;
  set<pt>::iterator it = s.lower_bound(a);
  if (it == s.end()) it = s.begin();
  pt q = *it;
  pt p = *prevCir(it);
  return (onSegment(a, p, q) || crossesRay(a, p, q));
}
void insert(pt a) {
  if (isIn(a)) return;
  set<pt>::iterator it = s.lower_bound(a);
  if (it == s.end()) it = s.begin();
  while ((int)s.size() > 2 && orient(a, *it, *nextCir(it)) <= 0) {
    it = nextCir(it);
    s.erase(prevCir(it));
  }
  it = prevCir(it);
  while ((int)s.size() > 2 && orient(a, *it, *prevCir(it)) >= 0) {
    it = prevCir(it);
    s.erase(nextCir(it));
  }
  s.insert(a);
}
int main() {
  ios::sync_with_stdio(false);
  int q;
  cin >> q;
  pt p, a[3];
  int type;
  for (int i = (0); i <= (2); ++i) {
    cin >> type >> a[i];
    piv = piv + a[i];
    a[i] = a[i] * 3;
  }
  for (int i = (0); i <= (2); ++i) {
    pt p = a[i] - piv;
    p.id = i + 1;
    s.insert(p);
  }
  for (int i = (4); i <= (q); ++i) {
    cin >> type >> p;
    p = p * 3;
    p = p - piv;
    p.id = i;
    if (type == 2) {
      bool ans = isIn(p);
      cout << (ans ? "YES" : "NO") << endl;
    } else {
      insert(p);
    }
  }
  return 0;
}