#include <bits/stdc++.h>
using namespace std;
long long n, k, m, t;
string s;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> n >> k >> m >> t;
  vector<long long> Mvs(n, 0);
  Mvs[k - 1] = 1;
  while (t--) {
    int type;
    cin >> type;
    if (type == 1) {
      int pos;
      cin >> pos;
      pos--;
      Mvs.insert(Mvs.begin() + pos, 0);
    } else {
      int pos;
      cin >> pos;
      bool ok = 0;
      for (int i = 0; i < pos; i++) {
        if (Mvs[i]) {
          ok = 1;
        }
      }
      if (!ok) {
        Mvs.erase(Mvs.begin(), Mvs.begin() + pos);
      } else {
        Mvs.erase(Mvs.begin() + pos, Mvs.end());
      }
    }
    cout << (long long)(Mvs).size() << ' ';
    for (int i = 0; i < (long long)(Mvs).size(); i++) {
      if (Mvs[i] == 1) {
        cout << i + 1 << " ";
        break;
      }
    }
    cout << "\n";
  }
}
