#include <bits/stdc++.h>
using namespace std;
bool DBG = 0;
const int dbg = 0;
using ii = pair<int, int>;
using cd = int64_t;
cd gcd(cd a, cd b) { return b ? gcd(b, a % b) : a; }
using _LD = long double;
struct ld {
  cd a, b;
  ld(cd a, cd b = 1) : a(a), b(b) { reduce(); }
  ld operator-() const { return {-a, b}; }
  ld& reduce() {
    if (a) {
      cd g = gcd(a < 0 ? -a : a, b);
      a /= g, b /= g;
    } else
      b = 1;
    return *this;
  }
  ld& operator+=(ld o) {
    a = a * o.b + b * o.a, b *= o.b;
    return reduce();
  }
  ld& operator-=(ld o) {
    a = a * o.b - b * o.a, b *= o.b;
    return reduce();
  }
  ld& operator*=(ld o) {
    a *= o.a, b *= o.b;
    return reduce();
  }
  ld operator*(ld o) const { return o *= *this; }
  ld operator+(ld o) const { return o += *this; }
  ld operator-(ld o) const {
    ld t = *this;
    return t -= o;
  }
  bool operator==(ld o) const { return a * o.b == b * o.a; }
  bool operator<(ld o) const { return (_LD(a) / b) < (_LD(o.a) / o.b); }
  bool operator<=(ld o) const { return *this == o || *this < o; }
  bool operator>(ld o) const { return !(*this <= o); }
  bool operator>=(ld o) const { return !(*this < o); }
  operator _LD() const { return _LD(a) / b; }
};
ld abs(ld a) { return {a.a < 0 ? -a.a : a.a, a.b}; }
using cord = ld;
using vi = vector<int>;
using vii = vector<ii>;
const ld eps = {0, 1};
struct po {
  cord X, Y;
  po operator-(po b) { return {X - b.X, Y - b.Y}; }
  po& operator-=(po b) {
    X -= b.X, Y -= b.Y;
    return *this;
  }
  po operator-() const { return {-X, -Y}; }
  ld cross(po b) const { return X * b.Y - Y * b.X; }
  bool operator<(const po& a) const {
    return (X == a.X) ? (Y < a.Y) : (X < a.X);
  }
  bool operator<=(const po& a) const {
    return (X == a.X) ? (Y <= a.Y) : (X <= a.X);
  }
  bool operator==(const po& a) const { return X == a.X && Y == a.Y; }
  operator complex<_LD>() const { return complex<_LD>(X, Y); }
  _LD arg() const { return ::arg(complex<_LD>(*this)); }
};
const _LD _EPS = 1e-9;
bool nb = 0;
struct acmp {
  bool operator()(const po& a, const po& b) const {
    if (a == b) return 0;
    _LD A = a.arg(), B = b.arg();
    return nb ? (A < B - _EPS) : (A < B);
  }
} _acmp;
bool argeq(po a, po b) { return (!_acmp(a, b)) && (!_acmp(b, a)); }
using ms = map<po, int, acmp>;
using poly = vector<po>;
ld abs(po a) { return a.X * a.X + a.Y * a.Y; }
using i64 = int64_t;
ostream& operator<<(ostream& os, ld first) {
  ld t = first;
  t *= {1, 1};
  return os << '(' << i64(t.a) << '/' << i64(t.b) << ')';
}
ostream& operator<<(ostream& os, po a) {
  return os << (arg(complex<_LD>(a)) * 180 / 3.14159265358979323846);
}
template <class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << '[';
  for (auto& V : v) os << V << ',';
  return os << '\b' << ']';
}
const ld ZERO = {0, 1};
int orient(po a, po b, po c) {
  cord r = (b - a).cross(c - a);
  return r == ZERO ? 0 : (r < ZERO ? -1 : 1);
}
const po Z = {0, 0};
int isfar(ms& m, ms::iterator it) {
  if (m.size() == 1) return 0;
  auto nx = it;
  ++nx;
  _LD theta = 0;
  if (nx == m.end()) nx = m.begin(), theta = 2 * 3.14159265358979323846;
  theta += nx->first.arg() - it->first.arg();
  if (abs(theta - 3.14159265358979323846) <= 1e-8 ||
      theta >= 3.14159265358979323846 + 1e-8)
    return 1;
  return 0;
}
ms::iterator prev(ms& m, ms::iterator it) {
  if (it == m.begin()) return --m.end();
  return --it;
}
void insert(ms& m, po p, int& far) {
  if (!m.empty()) {
    auto it = m.find(p);
    if (it != m.end()) return void(++it->second);
    far -= isfar(m, prev(m, m.lower_bound(p)));
    ++m[p];
    far += isfar(m, it = m.find(p));
    far += isfar(m, prev(m, it));
    if (far) far = 1;
  } else
    ++m[p], far = 1;
}
void remove(ms& m, po p, int& far) {
  if (m.size() == 1) {
    far = 1;
    if (!(--m[p])) m.erase(p);
    return;
  }
  auto it = prev(m.find(p));
  far -= isfar(m, it);
  if (!(--m[p])) m.erase(m.find(p));
  far |= isfar(m, prev(m, m.lower_bound(p)));
  if (far) far = 1;
}
struct S {
  int zcnt, far;
  int64_t ls;
  po z;
  map<po, int, acmp> ps;
  S(po z) : zcnt(0), far(1), ls(0), z(z) {}
  void insert(po p) {
    if (DBG) cout << "inserting " << p - z << endl;
    if ((p -= z) == Z) return void(++zcnt);
    auto it = ps.find(-p);
    if (it != ps.end()) {
      if (DBG) cout << "ls receives " << it->second << endl;
      ls += it->second;
    } else if (DBG)
      cout << "ls receieves 0\n";
    ::insert(ps, p, far);
  }
  void erase(po p) {
    if (DBG) cout << "erasing " << p - z << endl;
    if ((p -= z) == Z) return void(--zcnt);
    auto it = ps.find(-p);
    if (DBG) cout << "ls -= ps.find(" << -p << ")\n";
    if (it != ps.end()) {
      if (DBG) cout << "ls loses " << it->second << endl;
      ls -= it->second;
    } else if (DBG)
      cout << "ls loses 0\n";
    ::remove(ps, p, far);
  }
  int query() {
    if (DBG) cout << "zcnt=" << zcnt << ",ls=" << ls << endl;
    if (zcnt) return 1;
    if (ls) return 2;
    int N = ps.size();
    if (N < 3) return 0;
    return far ? 0 : 3;
  }
};
po cnv(int s, int p, int g) { return {ld(s, s + p + g), ld(p, s + p + g)}; }
int main() {
  if (dbg)
    freopen("inb.txt", "r", stdin);
  else
    cin.tie(0)->sync_with_stdio(0);
  int s, p, g;
  cin >> s >> p >> g;
  S d(cnv(s, p, g));
  int n;
  cin >> n;
  if (n <= 5000) nb = 1;
  char op;
  vector<tuple<int, int, int>> bs;
  for (auto i = 0; i != n; ++i) {
    if (DBG) cout << "i=" << i << endl;
    cin >> op;
    if (op == 'A') {
      cin >> s >> p >> g;
      bs.emplace_back(s, p, g);
      d.insert(cnv(s, p, g));
    } else {
      cin >> s;
      tie(s, p, g) = bs[s - 1];
      d.erase(cnv(s, p, g));
    }
    cout << d.query() << '\n';
  }
  return 0;
}
