#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, k, m, t;
  cin >> n >> k >> m >> t;
  while (t--) {
    int f, p;
    cin >> f >> p;
    if (f) {
      if (p <= k) {
        n++;
        k++;
      } else {
        n++;
      }
    } else {
      if (p < k) {
        n -= p;
        k -= p;
      } else {
        n -= (n - p);
      }
    }
    cout << n << ' ' << k << endl;
  }
}
