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>
struct Point {
  Point(int x, int y) : x_(x), y_(y) {}
  bool operator<(const Point& p) const { return x_ < p.x_; }
  bool operator>(const Point& p) const { return x_ > p.x_; }
  bool operator<=(const Point& p) const { return x_ <= p.x_; }
  bool operator==(const Point& p) const { return x_ == p.x_; }
  bool operator>=(const Point& p) const { return x_ >= p.x_; }
  Point operator-(const Point& p) const { return Point(x_ - p.x_, y_ - p.y_); }
  long long CrossProduct(const Point& p) {
    return 1ll * x_ * p.y_ - 1ll * y_ * p.x_;
  }
  int x_, y_;
};
template <typename T>
class SplayTree {
 public:
  struct Node {
    Node *left, *right;
    Node *pre, *suc;
    Node* parent;
    T key_;
    Node(T key)
        : left(nullptr),
          right(nullptr),
          pre(nullptr),
          suc(nullptr),
          parent(nullptr),
          key_(key) {}
    ~Node() {}
  };

 private:
  size_t tree_size_;
  Node* root;
  void LeftRotate(Node* x) {
    Node* y = x->right;
    if (y) {
      x->right = y->left;
      if (y->left) {
        y->left->parent = x;
      }
      y->parent = x->parent;
    }
    if (!x->parent) {
      root = y;
    } else if (x == x->parent->left) {
      x->parent->left = y;
    } else {
      x->parent->right = y;
    }
    if (y) {
      y->left = x;
    }
    x->parent = y;
  }
  void RightRotate(Node* x) {
    Node* y = x->left;
    if (y) {
      x->left = y->right;
      if (y->right) {
        y->right->parent = x;
      }
      y->parent = x->parent;
    }
    if (!x->parent) {
      root = y;
    } else if (x == x->parent->left) {
      x->parent->left = y;
    } else {
      x->parent->right = y;
    }
    if (y) {
      y->right = x;
    }
    x->parent = y;
  }
  void Splay(Node* x) {
    while (x->parent) {
      if (!x->parent->parent) {
        if (x == x->parent->left) {
          RightRotate(x->parent);
        } else {
          LeftRotate(x->parent);
        }
      } else if (x == x->parent->left && x->parent == x->parent->parent->left) {
        RightRotate(x->parent->parent);
        RightRotate(x->parent);
      } else if (x == x->parent->right &&
                 x->parent == x->parent->parent->right) {
        LeftRotate(x->parent->parent);
        LeftRotate(x->parent);
      } else if (x == x->parent->left &&
                 x->parent == x->parent->parent->right) {
        RightRotate(x->parent);
        LeftRotate(x->parent);
      } else {
        LeftRotate(x->parent);
        RightRotate(x->parent);
      }
    }
  }
  Node* SubtreeMin(Node* x) {
    while (x->left) {
      x = x->left;
    }
    return x;
  }
  Node* SubtreeMax(Node* x) {
    while (x->right) {
      x = x->right;
    }
    return x;
  }

 public:
  SplayTree() : root(nullptr) {}
  void Insert(const T& key) {
    Node* z = root;
    Node* p = nullptr;
    while (z) {
      p = z;
      if (z->key_ < key) {
        z = z->right;
      } else {
        z = z->left;
      }
    }
    z = new Node(key);
    z->parent = p;
    if (!p) {
      root = z;
    } else if (p->key_ < key) {
      p->right = z;
      if (p->suc) {
        p->suc->pre = z;
        z->suc = p->suc;
      }
      p->suc = z;
      z->pre = p;
    } else {
      p->left = z;
      if (p->pre) {
        p->pre->suc = z;
        z->pre = p->pre;
      }
      p->pre = z;
      z->suc = p;
    }
    Splay(z);
    tree_size_++;
  }
  Node* Find(const T& key) {
    Node* z = root;
    while (z) {
      if (z->key_ < key) {
        z = z->right;
      } else if (z->key_ > key) {
        z = z->left;
      } else {
        return z;
      }
    }
    return nullptr;
  }
  void Erase(const T& key) {
    Node* z = Find(key);
    if (!z) {
      return;
    }
    Splay(z);
    if (z->left) {
      z->left->parent = nullptr;
      Splay(z->pre);
      root = z->pre;
      z->pre->suc = z->suc;
      if (z->right) {
        z->suc->pre = z->pre;
        z->pre->right = z->right;
        z->right->parent = z->pre;
      }
    } else {
      if (z->right) {
        z->suc->pre = nullptr;
        root = z->right;
        z->right->parent = nullptr;
      }
    }
    delete z;
    tree_size_--;
  }
  Node* LowerBound(const T& key) {
    if (!tree_size_) {
      return nullptr;
    }
    if (SubtreeMax(root)->key_ < key) {
      return nullptr;
    }
    Node* p = root;
    while (true) {
      if (p->key_ == key) {
        return p;
      } else if (p->key_ < key) {
        p = p->right;
      } else {
        if (p->pre) {
          if (p->pre->key_ >= key) {
            p = p->left;
          } else {
            break;
          }
        } else {
          break;
        }
      }
    }
    return p;
  }
  Node* UpperBound(const T& key) {
    if (!tree_size_) {
      return nullptr;
    }
    if (SubtreeMax(root)->key_ <= key) {
      return nullptr;
    }
    Node* p = root;
    while (true) {
      if (p->key_ <= key) {
        p = p->right;
      } else {
        if (p->pre) {
          if (p->pre->key_ <= key) {
            break;
          } else {
            p = p->left;
          }
        } else {
          break;
        }
      }
    }
    return p;
  }
  Node* Begin() { return SubtreeMin(root); }
  const size_t& size() { return tree_size_; }
};
bool InHull(SplayTree<Point>& hull, const Point& p) {
  auto i = hull.LowerBound(Point(p.x_, std::numeric_limits<int>::min()));
  if (!i) {
    return false;
  }
  const Point& q = i->key_;
  if (q.x_ == p.x_) {
    return p.y_ <= q.y_;
  }
  if (i == hull.Begin()) {
    return false;
  }
  auto j = i;
  i = i->pre;
  return (j->key_ - p).CrossProduct(i->key_ - p) >= 0;
}
void AddPoint(SplayTree<Point>& hull, const Point& x) {
  {
    auto iter = hull.LowerBound(Point(x.x_, std::numeric_limits<int>::min()));
    if (!iter || iter->key_.x_ != x.x_) {
      hull.Insert(x);
    } else {
      iter->key_ = x;
    }
  }
  auto i = hull.UpperBound(x);
  if (i) {
    auto j = i;
    i = i->suc;
    while (true) {
      if (!i) {
        break;
      }
      if ((j->key_ - i->key_).CrossProduct(x - i->key_) <= 0) {
        hull.Erase(j->key_);
      } else {
        break;
      }
      j = i;
      i = i->suc;
    }
  }
  i = hull.Find(x);
  if (i != hull.Begin()) {
    for (auto j = i->pre; j != hull.Begin();) {
      i = j;
      j = j->pre;
      if ((j->key_ - i->key_).CrossProduct(x - i->key_) <= 0) {
        hull.Erase(i->key_);
      } else {
        break;
      }
    }
  }
}
SplayTree<Point> up_hull;
SplayTree<Point> down_hull;
void PrintHull(SplayTree<Point>& hull) {
  auto ptr = hull.Begin();
  while (ptr) {
    printf("{%d %d} ", ptr->key_.x_, ptr->key_.y_);
    ptr = ptr->suc;
  }
  printf("\n");
}
int main() {
  int N;
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) {
    int op, x, y;
    scanf("%d%d%d", &op, &x, &y);
    Point p = Point(x, y);
    Point q = Point(x, -y);
    bool in_upp = InHull(up_hull, p);
    bool in_down = InHull(down_hull, q);
    if (op == 1) {
      if (!in_upp) {
        AddPoint(up_hull, p);
      }
      if (!in_down) {
        AddPoint(down_hull, q);
      }
    } else {
      if (in_upp && in_down) {
        puts("YES");
      } else {
        puts("NO");
      }
    }
  }
  return 0;
}