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