#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k, m, t;
  cin >> n >> k >> m >> t;
  vector<pair<int, int> > p(t);
  for (int i = 0; i < t; i++) cin >> p[i].first >> p[i].second;
  for (int i = 0; i < t; i++) {
    if (p[i].first == 0) {
      if (k <= p[i].second)
        n = p[i].second;
      else {
        k -= p[i].second;
        n -= p[i].second;
      }
    } else {
      if (k >= p[i].second) k += 1;
      n += 1;
    }
    cout << n << " " << k << "\n";
  }
  return 0;
}
