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