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