#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, k, n, m, i;
  cin >> n >> k >> m >> t;
  for (i = 0; i < t; ++i) {
    int key, pos;
    cin >> key >> pos;
    if (key == 0) {
      if (pos < k) {
        k -= pos;
        n -= pos;
      } else {
        n = pos;
      }
    } else if (key == 1) {
      ++n;
      if (pos <= k) {
        ++k;
      }
    }
    cout << n << " " << k << endl;
  }
  return 0;
}
