#include <bits/stdc++.h>
using namespace std;
void func() {
  long long n, k, m, t;
  cin >> n >> k >> m >> t;
  vector<pair<long long, long long> > vect;
  for (int i = 0; i < t; i++) {
    long long t1, t2;
    cin >> t1 >> t2;
    vect.push_back(make_pair(t1, t2));
  }
  for (int i = 0; i < t; i++) {
    if (vect[i].first == 1) {
      n++;
      if (vect[i].second <= k) k++;
      cout << n << " " << k << endl;
    } else {
      if (vect[i].second < k) {
        n = n - vect[i].second;
        k = k - vect[i].second;
        cout << n << " " << k << endl;
      } else {
        n = vect[i].second;
        cout << n << " " << k << endl;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) func();
}
