#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const long long int M = 998244353;
int n, k, m, t;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k >> m >> t;
  while (t--) {
    int x, y;
    cin >> x >> y;
    if (x == 1) {
      if (y <= k) k++;
      n++;
    } else {
      if (y >= k)
        n = y;
      else
        n -= y, k -= y;
    }
    cout << n << " " << k;
    cout << "\n";
  }
  return 0;
}
