#include <bits/stdc++.h>
using namespace std;
void swapp(int &a, int &b);
double fabss(double a);
int maxx(int a, int b);
int minn(int a, int b);
int Del_bit_1(int n);
int lowbit(int n);
int abss(int a);
const double E = 2.718281828;
const double PI = acos(-1.0);
const int inf = (1 << 29);
const double ESP = 1e-6;
const int mod = (int)1e9 + 7;
const int N = (int)1e6 + 6;
int main() {
  int n, k, m, t;
  scanf("%d%d%d%d", &n, &k, &m, &t);
  for (int i = 1; i <= t; ++i) {
    int j, x;
    scanf("%d%d", &j, &x);
    if (j) {
      if (x <= k) ++k;
      ++n;
    } else {
      if (x < k)
        k -= x, n -= x;
      else
        n -= n - x;
    }
    printf("%d %d\n", n, k);
  }
  return 0;
}
int maxx(int a, int b) { return a > b ? a : b; }
void swapp(int &a, int &b) { a ^= b ^= a ^= b; }
int lowbit(int n) { return n & (-n); }
int Del_bit_1(int n) { return n & (n - 1); }
int abss(int a) { return a > 0 ? a : -a; }
double fabss(double a) { return a > 0 ? a : -a; }
int minn(int a, int b) { return a < b ? a : b; }
