#include <bits/stdc++.h>
const long long Inf = 1e18;
const long double eps = 1e-7;
long long LINF = (long long)2e18;
using namespace std;
long long mod = 1e9 + 7;
long long mod5 = 1e9 + 9;
long long mod3 = 998244353;
long long mod4 = 1000003;
long long mod2 = 1e9 + 123;
const int MAXN = 301000;
const int INF = 1000000000;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.precision(20);
  int n, k, m, t;
  cin >> n >> k >> m >> t;
  while (t--) {
    int type, ind;
    cin >> type >> ind;
    if (type == 0) {
      if (ind < k) {
        k -= ind;
        n -= ind;
      } else {
        n = ind;
      }
    } else {
      n++;
      if (ind <= k) {
        k++;
      }
    }
    cout << n << " " << k << endl;
  }
  return 0;
}
