#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, m, t;
  cin >> n >> k >> m >> t;
  int condition, position;
  vector<bool> arr(m);
  generate(arr.begin(), arr.begin() + n, []() { return 1; });
  for (size_t i = 0; i < t; ++i) {
    cin >> condition >> position;
    if (condition) {
      arr.insert(arr.begin() + position, 1);
      if (position <= k) {
        k++;
        n++;
        cout << n << " " << k << endl;
      } else {
        n++;
        cout << n << " " << k << endl;
      }
    } else {
      if (k <= position) {
        generate(arr.begin() + position, arr.begin() + n + 1,
                 []() { return 0; });
        n = position;
        cout << n << " " << k << endl;
      } else {
        generate(arr.begin(), arr.begin() + position, []() { return 0; });
        n -= position;
        k -= position;
        cout << n << " " << k << endl;
      }
    }
  }
}
