#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, k, t, i, a, b;
  cin >> n >> k >> m >> t;
  for (i = 1; i <= t; i++) {
    cin >> a >> b;
    if (a == 1) {
      n += 1;
      if (b <= k) k += 1;
    } else {
      if (b < k) {
        n = n - b;
        k = k - b;
      } else {
        n = b;
      }
    }
    cout << n << " " << k << endl;
  }
  return 0;
}
