#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int N, P, M, T;
  cin >> N >> P >> M >> T;
  deque<int> dq(N, 1);
  for (int x = 0; x < T; x++) {
    int typ, pos;
    cin >> typ >> pos;
    if (typ) {
      dq.push_back(1);
      if (pos <= P) P++;
      cout << dq.size() << " " << P << "\n";
    } else {
      int seg1 = pos;
      if (P <= seg1) {
        int Ind = dq.size() - seg1;
        while (Ind > 0) {
          dq.pop_back();
          Ind--;
        }
        cout << dq.size() << " " << P << "\n";
      } else {
        P -= seg1;
        while (seg1 > 0) {
          dq.pop_front();
          seg1--;
        }
        cout << dq.size() << " " << P << "\n";
      }
    }
  }
  return 0;
}
