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;
double prodvect(complex<double> p1, complex<double> p2) {
  return imag(conj(p1) * p2);
}
struct elem {
  double angle;
  int tipus;
  int ordre;
  int indexini;
  complex<double> p;
};
bool operator<(elem e1, elem e2) { return e1.ordre < e2.ordre; }
bool comparaangle(elem e1, elem e2) { return e1.angle < e2.angle; }
bool comparaindexini(elem e1, elem e2) { return e1.indexini < e2.indexini; }
elem anterior(elem e, set<elem> &s) {
  set<elem>::iterator it = s.find(e);
  if (s.begin() == it) it = s.end();
  it--;
  return *it;
}
elem seguent(elem e, set<elem> &s) {
  set<elem>::iterator it = s.find(e);
  it++;
  if (it == s.end()) it = s.begin();
  return *it;
}
double error = 0.00000000013;
int main() {
  int n;
  cin >> n;
  vector<elem> v(n);
  for (int i = 0; i < n; i++) {
    elem &e = v[i];
    double x, y;
    cin >> e.tipus >> x >> y;
    e.p = complex<double>(x, y);
    e.indexini = i;
  }
  complex<double> puntinterior =
      ((v[0].p + v[1].p + v[2].p) / 3.0) + complex<double>(error, error);
  for (int i = 0; i < n; i++) {
    elem &e = v[i];
    e.angle = arg(e.p - puntinterior);
  }
  sort(v.begin(), v.end(), comparaangle);
  for (int i = 0; i < n; i++) v[i].ordre = i;
  sort(v.begin(), v.end(), comparaindexini);
  set<elem> s;
  s.insert(v[0]);
  s.insert(v[1]);
  s.insert(v[2]);
  for (int i = 3; i < n; i++) {
    elem &e = v[i];
    complex<double> p = e.p;
    if (e.tipus == 1) {
      s.insert(e);
      elem eant = anterior(e, s);
      complex<double> pant = eant.p;
      elem enext = seguent(e, s);
      complex<double> pnext = enext.p;
      if (prodvect(pnext - pant, p - pant) > -error) {
        s.erase(e);
      } else {
        elem eantant = anterior(eant, s);
        complex<double> pantant = eantant.p;
        while (prodvect(pant - pantant, p - pant) < -error) {
          s.erase(eant);
          eant = anterior(e, s);
          pant = eant.p;
          eantant = anterior(eant, s);
          pantant = eantant.p;
        }
        elem enextnext = seguent(enext, s);
        complex<double> pnextnext = enextnext.p;
        while (prodvect(pnext - p, pnextnext - pnext) < -error) {
          s.erase(enext);
          enext = seguent(e, s);
          pnext = enext.p;
          enextnext = seguent(enext, s);
          pnextnext = enextnext.p;
        }
      }
    } else {
      s.insert(e);
      elem eant = anterior(e, s);
      complex<double> pant = eant.p;
      elem enext = seguent(e, s);
      complex<double> pnext = enext.p;
      if (prodvect(pnext - pant, p - pant) > -error) {
        cout << "YES" << endl;
      } else {
        cout << "NO" << endl;
      }
      s.erase(e);
    }
  }
}