#include <bits/stdc++.h>
using namespace std;
const int Inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3fll;
const long double inF = 11451419198101145141919810.1145141919810;
const long double pi = acosl(-1);
int s, p, g, n, m;
struct Point {
  long double x, y;
  Point() {}
  Point(long double x, long double y) : x(x), y(y) {}
} t, b[1 << 17];
int main() {
  scanf("%d%d%d%d", &s, &p, &g, &n);
  t = Point((long double)1.0 * s / (s + p + g),
            (long double)1.0 * p / (s + p + g));
  int chs = 0, lns = 0, siz = 0;
  map<long double, int> ss;
  while (n--) {
    char mode;
    scanf(" %c", &mode);
    if (mode == 'A') {
      int s, p, g;
      scanf("%d%d%d", &s, &p, &g);
      b[++m] = Point((long double)1.0 * s / (s + p + g),
                     (long double)1.0 * p / (s + p + g));
      if (fabs(b[m].x - t.x) < 1e-10 && fabs(b[m].y - t.y) < 1e-10)
        chs++;
      else {
        long double jj = atan2l(b[m].y - t.y, b[m].x - t.x);
        long double kk = atan2l(t.y - b[m].y, t.x - b[m].x);
        auto x = ss.lower_bound(kk - 1e-10);
        if (x != ss.end() && fabs(x->first - kk) < 1e-10) lns += x->second;
        auto y = ss.lower_bound(jj - 1e-10);
        if (y != ss.end() && fabs(y->first - jj) < 1e-10)
          y->second++;
        else
          ss[jj] = 1;
      }
      siz++;
    } else {
      int m;
      scanf("%d", &m);
      if (fabs(b[m].x - t.x) < 1e-10 && fabs(b[m].y - t.y) < 1e-10)
        chs--;
      else {
        long double jj = atan2l(b[m].y - t.y, b[m].x - t.x);
        long double kk = atan2l(t.y - b[m].y, t.x - b[m].x);
        auto x = ss.lower_bound(kk - 1e-10);
        if (x != ss.end() && fabs(x->first - kk) < 1e-10) lns -= x->second;
        auto y = ss.lower_bound(jj - 1e-10);
        y->second--;
        if (!y->second) ss.erase(y);
      }
      siz--;
    }
    if (chs)
      puts("1");
    else if (lns)
      puts("2");
    else {
      if (!ss.size() || siz < 3) {
        puts("0");
        continue;
      }
      auto bk = ss.end();
      bk--;
      long double xju = ss.begin()->first + 2 * pi - bk->first;
      auto x = ss.lower_bound(0);
      if (x == ss.begin()) {
        puts("0");
        continue;
      }
      auto y = x;
      y--;
      long double yju = x->first - y->first;
      if (xju > pi - 1e-10 || yju > pi - 1e-10) {
        puts("0");
        continue;
      }
      puts("3");
    }
  }
  return 0;
}
