#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  const int add = 1;
  const int remove = 0;
  long long int t, m, n, k, x, y, r, ans, c, operation, i;
  cin >> n >> k >> m >> t;
  while (t--) {
    cin >> operation >> i;
    if (operation == add) {
      n++;
      if (i <= k) {
        k++;
      }
    } else {
      if (k <= i) {
        n = i;
      } else {
        n -= i;
        k -= i;
      }
    }
    cout << n << ' ' << k << endl;
  }
  return 0;
}
