#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, k, t;
  cin >> n >> k >> m >> t;
  int lastuni = n, lastdoc = k;
  while (t--) {
    int a, i;
    cin >> a >> i;
    if (a == 0) {
      if (i == lastdoc)
        lastdoc = i, lastuni = i;
      else if (i + 1 == lastdoc)
        lastdoc = 1, lastuni = lastuni - i;
      else if (i < lastdoc)
        lastdoc -= i, lastuni = lastuni - i;
      else if (i > lastdoc)
        lastuni = i;
      cout << lastuni << ' ' << lastdoc << '\n';
    } else {
      lastuni += 1;
      if (i <= lastdoc) lastdoc += 1;
      cout << lastuni << ' ' << lastdoc << '\n';
    }
  }
}
