#include <bits/stdc++.h>
using namespace std;
int n, k, m, t;
vector<bool> verse;
void br(int pos) {
  bool ldoc = false;
  for (int i = 0; i < (pos + 1); i++) ldoc |= verse[i] == 1;
  vector<bool> nw;
  if (ldoc) {
    for (int i = 0; i < (pos + 1); i++) nw.push_back(verse[i]);
  } else {
    for (int i = pos + 1; i < ((int)verse.size()); i++) nw.push_back(verse[i]);
  }
  verse = nw;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k >> m >> t;
  verse = vector<bool>(n, 0);
  verse[k - 1] = true;
  for (int i = 0; i < (t); i++) {
    int tp, idx;
    cin >> tp >> idx;
    idx--;
    if (tp == 0) {
      br(idx);
    } else {
      verse.insert(verse.begin() + idx, 0);
    }
    int ps = 0;
    for (int i = 0; i < (verse.size()); i++) ps = verse[i] == 1 ? i : ps;
    cout << verse.size() << " " << ps + 1 << "\n";
  }
}
