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>
#pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
const int Q = 100005;
const int INF = (1 << 30);
namespace GE {
struct Point {
  double x, y;
  Point(double X = 0, double Y = 0) : x(X), y(Y) {}
  Point operator+(const Point& rhs) const {
    return (Point){x + rhs.x, y + rhs.y};
  }
  Point operator-(const Point& rhs) const {
    return (Point){x - rhs.x, y - rhs.y};
  }
};
Point basic;
inline double cross(Point a, Point b) { return a.x * b.y - a.y * b.x; }
inline double dis(Point x, Point y) {
  return sqrt((x.x - y.x) * (x.x - y.x) + (x.y - y.y) * (x.y - y.y));
}
const double eps = 1e-8;
bool operator<(Point rhs1, Point rhs2) {
  rhs1 = rhs1 - basic;
  rhs2 = rhs2 - basic;
  double ang1 = atan2(rhs1.y, rhs1.x), ang2 = atan2(rhs2.y, rhs2.x);
  return fabs(ang1 - ang2) > eps ? ang1 < ang2
                                 : (dis(rhs1, Point()) < dis(rhs2, Point()));
}
std::set<Point> S;
inline std::set<Point>::iterator Pre(std::set<Point>::iterator it) {
  if (it == S.begin()) it = S.end();
  return --it;
}
inline std::set<Point>::iterator Nxt(std::set<Point>::iterator it) {
  ++it;
  return it == S.end() ? S.begin() : it;
}
inline int query(Point x) {
  std::set<Point>::iterator it = S.lower_bound(x);
  if (it == S.end()) it = S.begin();
  return cross(x - *Pre(it), *it - *Pre(it)) < eps;
}
inline void Insert(Point x) {
  if (query(x)) return;
  S.insert(x);
  std::set<Point>::iterator it = Nxt(S.find(x));
  while (S.size() > 3 && cross(x - *Nxt(it), *it - *Nxt(it)) < eps)
    S.erase(it), it = Nxt(S.find(x));
  it = Pre(S.find(x));
  while (S.size() > 3 && cross(x - *it, *it - *Pre(it)) > -eps)
    S.erase(it), it = Pre(S.find(x));
}
}  // namespace GE
using namespace GE;
int n;
Point A[5];
inline void YES() {
  putchar('Y');
  putchar('E');
  putchar('S');
  putchar('\n');
}
inline void NO() {
  putchar('N');
  putchar('O');
  putchar('\n');
}
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  std::cin >> n;
  for (register int i = 1; i <= 3; ++i) {
    std::cin >> A[i].x >> A[i].x >> A[i].y;
    basic = basic + A[i];
  }
  basic.x = basic.x / 3;
  basic.y = basic.y / 3;
  for (register int i = 1; i <= 3; ++i) S.insert(A[i]);
  for (register int i = 4; i <= n; ++i) {
    int opt;
    double x, y;
    std::cin >> opt >> x >> y;
    if (opt == 1)
      Insert(Point(x, y));
    else
      query(Point(x, y)) ? YES() : NO();
  }
  return 0;
}