#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, k, m, t;
  cin >> n >> k >> m >> t;
  long long int curr = k;
  long long int noe = n;
  long long int a, b;
  while (t--) {
    cin >> a >> b;
    if (a == 0) {
      if (b < curr) {
        curr -= b;
        noe -= b;
        cout << noe << " " << curr << endl;
        continue;
      } else {
        noe = b;
        cout << noe << " " << curr << endl;
        continue;
      }
    } else {
      noe++;
      if (b <= curr) curr++;
      cout << noe << " " << curr << endl;
      continue;
    }
  }
}
