#include <bits/stdc++.h>
using namespace std;
inline bool isvowel(char ch) {
  ch = tolower(ch);
  return (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u');
}
bool isprime(int n) {
  if (n < 2 || (n % 2 == 0 && n != 2)) return false;
  for (int i = 3; i * i <= n; i += 2)
    if (n % i == 0) return false;
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, pos, len, m, t;
  cin >> n >> pos >> m >> t;
  len = n;
  while (t--) {
    int com, x;
    cin >> com >> x;
    if (com) {
      len++;
      if (pos >= x) {
        pos++;
      }
    } else {
      if (pos <= x) {
        len = x;
      } else {
        len -= x;
        pos -= x;
      }
    }
    cout << len << ' ' << pos << endl;
  }
  return 0;
}
