Problem: Real Cosmic Communications is the largest telecommunication company on a far far away planet, located at the very edge of the universe. RCC launches communication satellites.

The planet is at the very edge of the universe, so its form is half of a circle. Its radius is r, the ends of its diameter are points A and B. The line AB is the edge of the universe, so one of the half-planes contains nothing, neither the planet, nor RCC satellites, nor anything else. Let us introduce coordinates in the following way: the origin is at the center of AB segment, OX axis coincides with line AB, the planet is completely in y > 0 half-plane.

The satellite can be in any point of the universe, except the planet points. Satellites are never located beyond the edge of the universe, nor on the edge itself — that is, they have coordinate y > 0. Satellite antennas are directed in such way that they cover the angle with the vertex in the satellite, and edges directed to points A and B. Let us call this area the satellite coverage area. 

The picture below shows coordinate system and coverage area of a satellite.

<image>

When RCC was founded there were no satellites around the planet. Since then there have been several events of one of the following types: 

  1. 1 x y — launch the new satellite and put it to the point (x, y). Satellites never move and stay at the point they were launched. Let us assign the number i to the i-th satellite in order of launching, starting from one. 
  2. 2 i — remove satellite number i. 
  3. 3 i j — make an attempt to create a communication channel between satellites i and j. To create a communication channel a repeater is required. It must not be located inside the planet, but can be located at its half-circle border, or above it. Repeater must be in coverage area of both satellites i and j. To avoid signal interference, it must not be located in coverage area of any other satellite. Of course, the repeater must be within the universe, it must have a coordinate y > 0. 



For each attempt to create a communication channel you must find out whether it is possible.

Sample test has the following satellites locations: 

<image>

Input

The first line of input data contains integers r and n — radius of the planet and the number of events (1 ≤ r ≤ 109, 1 ≤ n ≤ 5·105).

Each of the following n lines describe events in the specified format.

Satellite coordinates are integer, the satisfy the following constraints |x| ≤ 109, 0 < y ≤ 109. No two satellites that simultaneously exist can occupy the same point. Distance from each satellite to the center of the planet is strictly greater than r.

It is guaranteed that events of types 2 and 3 only refer to satellites that exist at the moment. For all events of type 3 the inequality i ≠ j is satisfied.

Output

For each event of type 3 print «YES» on a separate line, if it is possible to create a communication channel, or «NO» if it is impossible.

Example

Input

5 8
1 -5 8
1 -4 8
1 -3 8
1 2 7
3 1 3
2 2
3 1 3
3 3 4


Output

NO
YES
YES

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int R, N;
int L;
pair<int, int> q[500050];
vector<tuple<int, int, int> > P;
vector<tuple<int, int, int> > query;
pair<int, int> Lx[500050];
int T[1 << 20];
const int ADD = 1 << 19;
set<int> Sx[500050], Sy[500050];
void Ins(int x, int y) {
  Sx[x].insert(y);
  Sy[y].insert(x);
  T[x + ADD] = *Sx[x].begin();
  x = (x + ADD) >> 1;
  while (x) T[x] = min(T[x << 1], T[x << 1 | 1]), x >>= 1;
}
void Del(int x, int y) {
  Sx[x].erase(y);
  Sy[y].erase(x);
  int v = ((int)Sx[x].size() ? *Sx[x].begin() : 1e9);
  T[x + ADD] = v;
  x = (x + ADD) >> 1;
  while (x) T[x] = min(T[x << 1], T[x << 1 | 1]), x >>= 1;
}
int read_t(int l, int r) {
  l += ADD, r += ADD;
  int res = 1e9;
  while (l <= r) {
    if (l & 1) res = min(res, T[l++]);
    if (!(r & 1)) res = min(res, T[r--]);
    l >>= 1, r >>= 1;
  }
  return res;
}
int del_x, del_y;
int Query(int x, int y) {
  int xv = max(Lx[x].first, Lx[y].first);
  int yv = max(Lx[x].second, Lx[y].second);
  del_x = 0, del_y = 0;
  if (Lx[x].first < Lx[y].first && Lx[x].second < Lx[y].second) del_x = 1;
  if (Lx[y].first < Lx[x].first && Lx[y].second < Lx[x].second) del_y = 1;
  if (del_x) Del(Lx[x].first, Lx[x].second);
  if (del_y) Del(Lx[y].first, Lx[y].second);
  if (read_t(1, xv - 1) <= yv - 1) return 0;
  int w1 = -1, w2 = -1;
  if (Lx[x].first == xv) w1 = Lx[x].second;
  if (Lx[y].first == xv) w2 = Lx[y].second;
  for (auto it = Sx[xv].begin(); it != Sx[xv].end(); ++it) {
    if (*it > yv) break;
    if (*it != w1 && *it != w2) return 0;
  }
  w1 = w2 = -1;
  if (Lx[x].second == yv) w1 = Lx[x].first;
  if (Lx[y].second == yv) w2 = Lx[y].first;
  for (auto it = Sy[yv].begin(); it != Sy[yv].end(); ++it) {
    if (*it > xv) break;
    if (*it != w1 && *it != w2) return 0;
  }
  pair<int, int> v1, v2;
  if (Lx[x].first >= Lx[y].first)
    v1 = pair<int, int>(q[x].first + R, q[x].second);
  else
    v1 = pair<int, int>(q[y].first + R, q[y].second);
  if (Lx[x].second >= Lx[y].second)
    v2 = pair<int, int>(q[x].first - R, q[x].second);
  else
    v2 = pair<int, int>(q[y].first - R, q[y].second);
  if ((long long)v1.first * v2.first + (long long)v1.second * v2.second >= 0)
    return 1;
  return 0;
}
int main() {
  scanf("%d%d", &R, &N);
  for (int i = 1; i <= N; i++) {
    int cmd;
    scanf("%d", &cmd);
    if (cmd == 1) {
      int x, y;
      scanf("%d%d", &x, &y);
      P.push_back(tuple<int, int, int>(x, y, ++L));
      q[L] = pair<int, int>(x, y);
      query.push_back(tuple<int, int, int>(1, L, -1));
    } else if (cmd == 2) {
      int x;
      scanf("%d", &x);
      query.push_back(tuple<int, int, int>(2, x, -1));
    } else {
      int x, y;
      scanf("%d%d", &x, &y);
      query.push_back(tuple<int, int, int>(3, x, y));
    }
  }
  int xz = 1, yz = 1;
  auto comp = [&](const tuple<int, int, int> &a,
                  const tuple<int, int, int> &b) {
    return (long long)(get<0>(a) + R) * get<1>(b) -
               (long long)get<1>(a) * (get<0>(b) + R) <
           0;
  };
  sort(P.begin(), P.end(), comp);
  for (int i = 0; i < (int)P.size(); i++) {
    Lx[get<2>(P[i])].first = xz;
    if (i < (int)P.size() - 1 && comp(P[i], P[i + 1])) ++xz;
  }
  auto comp2 = [&](const tuple<int, int, int> &a,
                   const tuple<int, int, int> &b) {
    return (long long)(get<0>(a) - R) * get<1>(b) -
               (long long)get<1>(a) * (get<0>(b) - R) >
           0;
  };
  sort(P.begin(), P.end(), comp2);
  for (int i = 0; i < (int)P.size(); i++) {
    Lx[get<2>(P[i])].second = yz;
    if (i < (int)P.size() - 1 && comp2(P[i], P[i + 1])) ++yz;
  }
  for (int i = 0; i < 1 << 20; i++) T[i] = 1e9;
  for (tuple<int, int, int> e : query) {
    int cmd, x, y;
    tie(cmd, x, y) = e;
    if (cmd == 1) {
      int xv = Lx[x].first, yv = Lx[x].second;
      Ins(xv, yv);
    } else if (cmd == 2) {
      int xv = Lx[x].first, yv = Lx[x].second;
      Del(xv, yv);
    } else {
      int v = Query(x, y);
      if (del_x) Ins(Lx[x].first, Lx[x].second);
      if (del_y) Ins(Lx[y].first, Lx[y].second);
      printf("%s\n", v ? "YES" : "NO");
    }
  }
  return 0;
}