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