#include <bits/stdc++.h>
using namespace std;
int n, k, m, t;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> k >> m >> t;
  int nowlen = n, nowk = k;
  int x, y;
  while (t--) {
    cin >> x >> y;
    if (x == 1) {
      nowlen++;
      if (nowk >= y) {
        nowk++;
      }
    } else {
      if (nowk <= y) {
        nowlen = y;
      } else {
        nowlen -= y;
        nowk -= y;
      }
    }
    cout << nowlen << " " << nowk << endl;
  }
}
