#include <bits/stdc++.h>
using namespace std;
void incr(long long &st, long long &en, long long &k, long long val) {
  en++;
  if (val <= k) {
    k++;
  }
}
void decr(long long &st, long long &en, long long &k, long long val) {
  long long sz = en - st + 1;
  if (val < k) {
    k -= val;
    sz = sz - val;
  } else {
    sz = val;
  }
  st = 1;
  en = sz + st - 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k, m, t;
  cin >> n >> k >> m >> t;
  long long st = 1, en = n;
  while (t--) {
    long long w, val;
    cin >> w >> val;
    if (w) {
      incr(st, en, k, val);
      cout << (en - st + 1) << " " << k << endl;
    } else {
      decr(st, en, k, val);
      cout << (en - st + 1) << " " << k << endl;
    }
  }
  return 0;
}
