#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 50;
int ans[maxn];
int main() {
  int n, k, m, t;
  cin >> n >> k >> m >> t;
  int l = n;
  while (t--) {
    int op, p;
    cin >> op >> p;
    if (op == 1) {
      if (p <= k) k++;
      l++;
    } else {
      if (p >= k) {
        l = l - (l - p);
      } else {
        l -= p;
        k -= p;
      }
    }
    cout << l << " " << k << endl;
  }
  return 0;
}
