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 long double EPS = 1e-5;
inline int sgn(const long double &a) { return (a > EPS) - (a < -EPS); }
pair<long double, long double> operator+=(
    pair<long double, long double> &a,
    const pair<long double, long double> &b) {
  return pair<long double, long double>(a.first += b.first,
                                        a.second += b.second);
}
pair<long double, long double> operator-(
    const pair<long double, long double> &a,
    const pair<long double, long double> &b) {
  return pair<long double, long double>(a.first - b.first, a.second - b.second);
}
istream &operator>>(istream &in, pair<long double, long double> &a) {
  return in >> a.first >> a.second;
}
inline long double cross(const pair<long double, long double> &a,
                         const pair<long double, long double> &b) {
  return a.first * b.second - a.second * b.first;
}
inline long double angle(const pair<long double, long double> &a) {
  return atan2(a.second, a.first);
}
inline long double veclen(const pair<long double, long double> &a) {
  return hypot(a.first, a.second);
}
bool inTriangle(const pair<long double, long double> &p,
                const pair<long double, long double> &a,
                const pair<long double, long double> &b,
                const pair<long double, long double> &c) {
  long double area1 = fabs(cross(a - p, b - p));
  long double area2 = fabs(cross(b - p, c - p));
  long double area3 = fabs(cross(c - p, a - p));
  long double area = fabs(cross(b - a, c - a));
  return sgn(area - area1 - area2 - area3) == 0;
}
struct ConvexHull {
  static pair<long double, long double> center;
  struct Compare {
    bool operator()(const pair<long double, long double> &a,
                    const pair<long double, long double> &b) {
      long double a1 = angle(a - center);
      long double a2 = angle(b - center);
      if (a1 != a2) {
        return a1 > a2;
      }
      return a < b;
    }
  };
  static set<pair<long double, long double>, Compare> hull;
  template <class T>
  static T Last(T a) {
    if (a == hull.begin()) {
      a = hull.end();
    }
    return --a;
  }
  template <class T>
  static T Next(T a) {
    if (++a == hull.end()) {
      a = hull.begin();
    }
    return a;
  }
  static void clear(const pair<long double, long double> &p) {
    center = p;
    hull.clear();
  }
  static void insert(const pair<long double, long double> &p) {
    if (hull.size() < 3) {
      hull.insert(p);
      return;
    }
    if (test(p)) {
      return;
    }
    const auto it = hull.insert(p).first;
    while (sgn(cross(*Next(it) - p, *Next(Next(it)) - p)) >= 0) {
      hull.erase(Next(it));
    }
    while (sgn(cross(*Last(it) - p, *Last(Last(it)) - p)) <= 0) {
      hull.erase(Last(it));
    }
  }
  static void show() {
    cout << "Convex Hull " << hull.size() << endl;
    for (auto it = hull.begin(); it != hull.end(); ++it) {
      cout << double(it->first) << ' ' << double(it->second) << endl;
    }
    cout << "-------------" << endl;
  }
  static bool test(const pair<long double, long double> &p) {
    auto it = hull.upper_bound(p);
    if (it == hull.end()) {
      it = hull.begin();
    }
    return inTriangle(p, center, *it, *Last(it));
  }
};
pair<long double, long double> ConvexHull::center;
set<pair<long double, long double>, ConvexHull::Compare> ConvexHull::hull;
int run() {
  int n;
  while (cin >> n) {
    int op, first, second;
    pair<long double, long double> temp(0, 0), pt[3];
    for (int i = 0; i < 3; ++i) {
      cin >> op >> first >> second;
      temp += (pt[i] = pair<long double, long double>(first, second));
    }
    temp.first /= 3;
    temp.second /= 3;
    ConvexHull::clear(temp);
    for (int i = 0; i < 3; ++i) {
      ConvexHull::insert(pt[i]);
    }
    for (int i = 3; i < n; ++i) {
      cin >> op >> first >> second;
      if (op == 1) {
        ConvexHull::insert(pair<long double, long double>(first, second));
      } else {
        cout << (ConvexHull::test(pair<long double, long double>(first, second))
                     ? "YES"
                     : "NO")
             << endl;
      }
    }
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(0);
  return run();
}