#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
bool isprime(long long n) {
  for (long long i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) return false;
  }
  return true;
}
int main() {
  long long n, m, k, t;
  cin >> n >> k >> m >> t;
  while (t--) {
    long long s, s1;
    cin >> s >> s1;
    if (s == 1) {
      if (s1 <= k) {
        k++;
      }
      n++;
      cout << n << " " << k << endl;
    } else {
      if (s1 < k) {
        k = k - s1;
        n = n - s1;
        cout << n << " " << k << endl;
      } else if (s1 >= k) {
        n = s1;
        cout << n << " " << k << endl;
      }
    }
  }
  return 0;
}
