#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
using vll = vector<ll>;
using vpll = vector<pll>;
using gr = vector<vll>;
using wgr = vector<vpll>;
struct d_ {
  template <typename T>
  d_& operator,(const T& x) {
    cerr << ' ' << x;
    return *this;
  }
  template <typename T>
  d_& operator,(const vector<T>& x) {
    for (auto x : x) cerr << ' ' << x;
    return *this;
  }
} d_t;
ll n, k, m, t;
int main(void) {
  ios_base::sync_with_stdio(false);
  cin >> n >> k >> m >> t;
  for (ll i(0); i < t; i++) {
    ll typ, pos;
    cin >> typ >> pos;
    if (typ == 1) {
      n++;
      if (pos <= k) k++;
    } else {
      if (pos < k) {
        n -= pos;
        k -= pos;
      } else {
        n -= (n - pos);
      }
    }
    cout << n << ' ' << k << endl;
  }
  return 0;
}
