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