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