#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long N = 100 + 5;
const long double pi = 3.14159265359;
void SRAND() {
  auto duration = std::chrono::system_clock::now().time_since_epoch();
  auto millis =
      std::chrono::duration_cast<std::chrono::milliseconds>(duration).count();
  srand(millis);
}
long long n, k, m, t, id, ty;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k >> m >> t;
  k--;
  while (t--) {
    cin >> ty >> id;
    if (ty == 0) {
      if (k >= id) {
        k -= id;
        n -= id;
      } else {
        n = id;
      }
    } else {
      id--;
      if (k >= id) k++;
      n++;
    }
    cout << n << " " << k + 1 << "\n";
  }
  return 0;
}
