#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) { cout << endl; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ' ';
  err(++it, args...);
}
int dx[8] = {1, 0, -1, 0, -1, -1, 1, 1};
int dy[8] = {0, 1, 0, -1, -1, 1, -1, 1};
int ini() {
  int x;
  scanf("%d", &x);
  return x;
}
long long inl() {
  long long x;
  scanf("%lld", &x);
  return x;
}
int set_1(int n, int pos) { return n = (n | (1 << pos)); }
int reset_0(int n, int pos) { return n = n & ~(1 << pos); }
bool check_bit(int n, int pos) { return n = n & (1 << pos); }
const int N = (int)1e6 + 5;
const int M = (int)1e9 + 7;
const double pi = 2 * acos(0.0);
int main() {
  int n, k, m, t;
  cin >> n >> k >> m >> t;
  int pos = k, sz = n;
  while (t--) {
    int op, x;
    cin >> op >> x;
    if (op == 0) {
      if (x < pos) {
        pos = pos - x;
        sz = sz - x;
      } else if (x > pos) {
        sz = x;
      } else {
        sz = pos;
      }
    } else {
      sz++;
      if (x <= pos) {
        pos += 1;
      }
    }
    cout << sz << " " << pos << endl;
  }
  return 0;
}
