#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 x, y;
    cin >> x >> y;
    if (x == 1) {
      if (y <= k) k++;
      n++;
    } else {
      if (y < k)
        k -= y, n -= y;
      else
        n = y;
    }
    cout << n << " " << k << "\n";
  }
}
