#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k, m, t;
  cin >> n >> k >> m >> t;
  vector<long long> a(n, 0);
  a[k - 1] = 1;
  while (t--) {
    long long x, y;
    cin >> x >> y;
    if (x == 1) {
      y--;
      a.insert(a.begin() + y, 0);
    } else {
      y--;
      long long f = find(a.begin(), a.end(), 1) - a.begin();
      if (f > y)
        a.erase(a.begin(), a.begin() + y + 1);
      else {
        a.erase(a.begin() + y + 1, a.end());
      }
    }
    long long f = find(a.begin(), a.end(), 1) - a.begin();
    cout << a.size() << " " << f + 1 << "\n";
  }
  return 0;
}
