#include <bits/stdc++.h>
using namespace std;
const int N = 1000006, INF = 1000000009;
pair<int, int> p[N], a[N];
int n, m, k = 1, t, x, l, y, z, o, ans[N], Ans, d, b[N], c[N], xmax, xmin = INF,
          ymax, ymin = INF;
string s, second;
vector<int> v[30];
int main() {
  cin >> n >> k >> m >> t;
  while (t--) {
    cin >> x >> l;
    if (x) {
      n++;
      if (l <= k) k++;
    } else {
      if (l < k)
        k -= l, n -= l;
      else
        n = l;
    }
    cout << n << " " << k << endl;
  }
  return 0;
}
