#include <bits/stdc++.h>
using namespace std;
int n;
long long V[3], Q[100001][3];
pair<long long, long long> P[100001];
int I[3];
long long gcd(long long first, long long second) {
  for (; second; swap(first, second)) first %= second;
  return max(first, 1ll);
}
pair<long long, long long> get(int it) {
  long long first = 0, m = 0, R[3] = {};
  for (int i = 0; i < 3; ++i) {
    first += V[i] * V[i];
    m += V[i] * Q[it][i];
  }
  for (int i = 0; i < 3; ++i) {
    R[i] = first * Q[it][i] - m * V[i];
  }
  long long g = gcd(abs(R[1]), abs(R[2]));
  return pair<long long, long long>(R[1] / g, R[2] / g);
}
int ccw(pair<long long, long long> a, pair<long long, long long> b) {
  if (a == b) return 0;
  long double ld = 1.L * a.first * b.second - 1.L * a.second * b.first;
  if (ld > 0) return 1;
  return -1;
}
struct cmp {
  bool operator()(const pair<long long, long long> &a,
                  const pair<long long, long long> &b) const {
    if (a.second < 0 && b.second > 0) return 0;
    if (a.second > 0 && b.second < 0) return 1;
    if (a.second == 0 && b.second == 0) return a.first > b.first;
    if (a.first > 0 && a.second == 0) return 1;
    if (b.first > 0 && b.second == 0) return 0;
    return ccw(a, b) > 0;
  }
};
pair<long long, long long> operator-(pair<long long, long long> a) {
  return pair<long long, long long>(-a.first, -a.second);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  for (int i = 0; i < 3; ++i) {
    cin >> V[i];
    I[i] = i;
  }
  for (int i = 0, j = 0; i < 3; ++i) {
    if (V[i] > 0) swap(V[i], V[j]), swap(I[i], I[j]), ++j;
  }
  int idx = 0;
  int cnt0 = 0, cnt180 = 0;
  long long cntP = 0;
  map<pair<long long, long long>, int, cmp> mp;
  cin >> n;
  for (int it = 1; it <= n; ++it) {
    char T[5];
    cin >> T;
    if (T[0] == 'A') {
      ++idx;
      long long in[3];
      for (int i = 0; i < 3; ++i) cin >> in[i];
      for (int i = 0; i < 3; ++i) Q[idx][i] = in[I[i]];
      P[idx] = get(idx);
      if (P[idx] == pair<long long, long long>(0, 0))
        ++cnt0;
      else {
        if (++mp[P[idx]] == 1) {
          auto it = mp.find(P[idx]);
          if (it != mp.begin() && next(it) != mp.end()) {
            if (ccw(prev(it)->first, next(it)->first) < 0) --cnt180;
          }
          if (it != mp.begin()) {
            if (ccw(prev(it)->first, it->first) < 0) ++cnt180;
          }
          if (next(it) != mp.end()) {
            if (ccw(it->first, next(it)->first) < 0) ++cnt180;
          }
        }
        if (mp.count(-P[idx])) cntP += mp[-P[idx]];
      }
    } else {
      int idx;
      cin >> idx;
      if (P[idx] == pair<long long, long long>(0, 0))
        --cnt0;
      else {
        if (--mp[P[idx]] == 0) {
          auto it = mp.find(P[idx]);
          if (it != mp.begin() && next(it) != mp.end()) {
            if (ccw(prev(it)->first, next(it)->first) < 0) ++cnt180;
          }
          if (it != mp.begin()) {
            if (ccw(prev(it)->first, it->first) < 0) --cnt180;
          }
          if (next(it) != mp.end()) {
            if (ccw(it->first, next(it)->first) < 0) --cnt180;
          }
          mp.erase(it);
        }
        if (mp.count(-P[idx])) cntP -= mp[-P[idx]];
      }
    }
    if (cnt0)
      printf("1\n");
    else if (cntP)
      printf("2\n");
    else if (int(mp.size()) <= 1 || cnt180)
      printf("0\n");
    else if (ccw(mp.rbegin()->first, mp.begin()->first) < 0)
      printf("0\n");
    else
      printf("3\n");
  }
  return 0;
}
