#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using db = long double;
using ii = pair<int, int>;
const int N = 3e5 + 5, LG = 19, MOD = 1e9 + 7;
const int SQ = 225;
const long double EPS = 1e-7;
int n;
string s;
int ans[N];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k, m, t;
  cin >> n >> k >> m >> t;
  vector<int> ben10(n);
  ben10[k - 1] = 1;
  while (t--) {
    int tp, idx;
    cin >> tp >> idx;
    if (tp == 1) {
      ben10.insert(ben10.begin() + idx - 1, 0);
    } else {
      vector<int> lft;
      for (int j = 0; j < idx; j++)
        lft.push_back(ben10[0]), ben10.erase(ben10.begin());
      if (find(ben10.begin(), ben10.end(), 1) == ben10.end()) ben10 = lft;
    }
    cout << ben10.size() << ' '
         << find(ben10.begin(), ben10.end(), 1) - ben10.begin() + 1 << '\n';
  }
  return 0;
}
