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.1415926535897932384626433832795;
struct Pnt {
  Pnt() : x(0), y(0) {}
  Pnt(double x, double y) : x(x), y(y) {}
  Pnt operator+(Pnt const& p) const { return Pnt(x + p.x, y + p.y); }
  Pnt operator-(Pnt const& p) const { return Pnt(x - p.x, y - p.y); }
  Pnt operator*(double a) const { return Pnt(x * a, y * a); }
  double operator*(Pnt p) const { return x * p.x + y * p.y; }
  double operator^(Pnt p) const { return x * p.y - y * p.x; }
  double angle() const { return atan2(y, x); }
  bool operator==(Pnt p) const {
    return make_pair(x, y) == make_pair(p.x, p.y);
  }
  void read() { scanf("%lf%lf", &x, &y); }
  double x, y;
};
struct Sect {
  Sect(Pnt a, Pnt b) : a(a), b(b) {
    assert((a ^ b) >= 0);
    l = a.angle();
  }
  bool operator<(Sect const& s) const { return l + 1e-13 < s.l; }
  Pnt to() const { return b - a; }
  double l;
  Pnt a, b;
};
inline set<Sect>::iterator next(set<Sect>::iterator si, set<Sect>& sects) {
  return (++si == sects.end()) ? sects.begin() : si;
}
inline set<Sect>::iterator prev(set<Sect>::iterator si, set<Sect>& sects) {
  if (si == sects.begin()) si = sects.end();
  return --si;
}
set<Sect>::iterator getSect(Pnt p, set<Sect>& sects) {
  set<Sect>::iterator i = sects.upper_bound(Sect(p, p));
  if (i == sects.begin()) i = sects.end();
  --i;
  assert((i->a ^ p) >= 0);
  assert((p ^ i->b) >= 0);
  return i;
}
int main() {
  long st = clock();
  int q;
  scanf("%d", &q);
  q -= 3;
  assert(q > 0);
  Pnt origin;
  set<Sect> sects;
  {
    Pnt p[3];
    for (int(i) = 0; (i) < (3); ++(i)) {
      scanf("%*d");
      p[i].read();
      origin = origin + p[i];
    }
    for (int(i) = 0; (i) < (3); ++(i)) p[i] = p[i] * 3.0 - origin;
    if ((p[0] ^ p[1]) < 0) swap(p[0], p[1]);
    assert((p[0] ^ p[1]) >= 0);
    assert((p[1] ^ p[2]) >= 0);
    assert((p[2] ^ p[0]) >= 0);
    for (int(i) = 0; (i) < (3); ++(i)) sects.insert(Sect(p[i], p[(i + 1) % 3]));
  }
  for (int(reqIt) = 0; (reqIt) < (q); ++(reqIt)) {
    if (reqIt % 200 == 0 && clock() - st >= 1.8 * CLOCKS_PER_SEC) {
      printf("%d outputted\n", reqIt);
      return 0;
    }
    int req;
    scanf("%d", &req);
    Pnt p;
    p.read();
    p = p * 3.0 - origin;
    if (p == Pnt(0, 0)) {
      if (req == 2) printf("YES\n");
      continue;
    }
    set<Sect>::iterator si = getSect(p, sects);
    if (req == 1) {
      if (((p - si->a) ^ si->to()) <= 0) continue;
      set<Sect>::iterator left = si;
      set<Sect>::iterator prevl = prev(si, sects);
      set<Sect>::iterator right = si;
      set<Sect>::iterator nextr = next(si, sects);
      while (((left->a - p) ^ (prevl->a - p)) >= 0) {
        left = prevl;
        prevl = prev(prevl, sects);
      }
      while (((right->b - p) ^ (nextr->b - p)) <= 0) {
        right = nextr;
        nextr = next(nextr, sects);
      }
      Sect s1(left->a, p);
      Sect s2(p, right->b);
      bool run = true;
      for (set<Sect>::iterator i = left; run;) {
        if (i == right) run = false;
        set<Sect>::iterator toDelete = i;
        i = next(i, sects);
        sects.erase(toDelete);
        if (!run) break;
      }
      sects.insert(s1);
      sects.insert(s2);
    } else {
      printf("%s\n", (((p - si->a) ^ si->to()) > 0) ? "NO" : "YES");
    }
  }
  return 0;
}