#include <bits/stdc++.h>
using namespace std;
deque<long long> d;
long long sz;
long long find_pos() {
  for (long long i = 0; i < sz; i++) {
    if (d[i] == 1) return i + 1;
  }
  return 0;
}
signed main() {
  long long n, m, k, t;
  cin >> n >> k >> m >> t;
  d.resize(n, 0);
  d[k - 1] = 1;
  for (long long i = 0; i < t; i++) {
    long long op;
    cin >> op;
    sz = (long long)d.size();
    if (op == 1) {
      long long pos;
      cin >> pos;
      pos--;
      if (sz == m) {
        cout << sz << endl;
      } else {
        sz++;
        cout << sz << endl;
        d.insert(d.begin() + pos, 0);
        cout << find_pos() << endl;
      }
    } else {
      long long pos;
      cin >> pos;
      long long cur = find_pos();
      if (pos < cur) {
        while (pos--) {
          d.pop_front();
        }
      } else {
        pos = sz - pos;
        while (pos--) {
          d.pop_back();
        }
      }
      sz = (long long)d.size();
      cout << sz << endl;
      cout << find_pos() << endl;
    }
  }
}
