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