#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> cur;
  int n, k, m, t, p, v;
  bool he;
  cin >> n >> k >> m >> t;
  cur.assign(n, 0);
  cur[k - 1] = 1;
  while (t--) {
    cin >> p >> v;
    vector<int> nxt;
    switch (p) {
      case 1:
        v--;
        for (int j = 0; j < v; j++) {
          nxt.push_back(cur[j]);
        }
        nxt.push_back(0);
        for (int j = v; j < n; j++) {
          nxt.push_back(cur[j]);
        }
        break;
      case 0:
        he = false;
        for (int i = 0; i < v; i++) {
          if (cur[i] == 1) {
            he = true;
          }
        }
        if (he) {
          for (int j = 0; j < v; j++) {
            nxt.push_back(cur[j]);
          }
        } else {
          for (int j = v; j < n; j++) {
            nxt.push_back(cur[j]);
          }
        }
    }
    n = nxt.size();
    for (int i = 0; i < n; i++)
      if (nxt[i] == 1) k = i + 1;
    cout << n << " " << k << endl;
    cur = nxt;
  }
  return 0;
}
