#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9;
const long long mod = 1e9 + 7;
const long double eps = 1e-9;
int main() {
  int n, k, m, t;
  cin >> n >> k >> m >> t;
  int LEN = n;
  while (t--) {
    int type, c;
    cin >> type >> c;
    if (type == 0) {
      if (c < k) {
        LEN -= c;
        k -= c;
      } else {
        LEN = c;
      }
    } else {
      LEN++;
      if (c <= k) k++;
    }
    cout << LEN << ' ' << k << endl;
  }
  return 0;
}
