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