#include <bits/stdc++.h>
using namespace std;
int n, m, k;
vector<int> v;
int main(int argc, char const *argv[]) {
  cin >> n >> k >> m;
  --k;
  int i;
  v = vector<int>(n, 0);
  int t;
  cin >> t;
  while (t--) {
    int op, pos;
    cin >> op >> pos;
    --pos;
    if (op == 1) {
      if (pos <= k) ++k;
      v.insert(v.begin() + pos, 0);
    } else {
      vector<int> temp;
      if (pos < k) {
        for (i = (pos + 1); i < ((int)((v).size())); i++) temp.push_back(v[i]);
        k -= pos + 1;
      } else {
        for (i = (0); i <= (pos); i++) temp.push_back(v[i]);
      }
      v = temp;
    }
    cout << (int)((v).size()) << " " << k + 1 << '\n';
  }
  return 0;
}
