#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e12;
void faster() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
const long long MAXN = 1e6 + 10;
const long long N = 100 + 10;
const long long mod = 1e9 + 7;
long long x[N], y[N];
int main() {
  faster();
  int n, m, k, t;
  cin >> n >> k >> m >> t;
  while (t--) {
    int c, l;
    cin >> c >> l;
    if (c) {
      if (l <= k) {
        k++;
      }
      n++;
      cout << n << " " << k << endl;
    } else {
      if (l < k) {
        k -= (l + 1) - 1;
        n -= (l + 1) - 1;
      } else {
        n = l;
      }
      cout << n << " " << k << endl;
    }
  }
}
