#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, m, t;
  cin >> n >> k >> m >> t;
  int ty, pos;
  while (t--) {
    cin >> ty >> pos;
    if (ty == 0) {
      if (n == 1) {
        cout << n << " " << k << endl;
      } else {
        if (pos >= k) {
          cout << k + (pos - k) << " " << k << endl;
          n = k + (pos - k);
        } else {
          cout << n - pos << " " << k - pos << endl;
          n = n - pos;
          k = k - pos;
        }
      }
    } else {
      if (n == m) {
        cout << n << " " << k << endl;
      } else {
        if (pos > k) {
          cout << n + 1 << " " << k << endl;
          n++;
        } else {
          cout << n + 1 << " " << k + 1 << endl;
          n++;
          k++;
        }
      }
    }
  }
}
