#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k, m, t;
  cin >> n >> k >> m >> t;
  while (t--) {
    int type, pos;
    cin >> type >> pos;
    if (type) {
      n++;
      if (pos <= k) k++;
    } else {
      if (pos >= k)
        n = pos;
      else {
        n -= pos;
        k -= pos;
      }
    }
    cout << n << ' ' << k << '\n';
  }
  return 0;
}
