#include <bits/stdc++.h>
using namespace std;
int n, k, m, t, i, l, r;
int main() {
  cin >> n >> k >> m >> t;
  vector<int> a(n);
  fill(a.begin(), a.end(), 0);
  a[k - 1] = 1;
  while (t--) {
    cin >> l >> r;
    if (l == 1) {
      if (r > a.size())
        a.push_back(0);
      else
        a.emplace(a.begin() + r - 1, 0);
    } else {
      for (i = 0; i < a.size(); i++)
        if (a[i]) break;
      if (i + 1 <= r)
        a.erase(a.begin() + r, a.end());
      else
        a.erase(a.begin(), --a.begin() + r + 1);
    }
    for (i = 0; i < a.size(); i++)
      if (a[i]) {
        cout << a.size() << ' ' << i + 1 << endl;
        break;
      }
  }
}
