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