#include <bits/stdc++.h>
using namespace std;
int a[300];
int main() {
  int k, n, m, t;
  cin >> n >> k >> m >> t;
  int operation, location, end;
  end = n;
  while (t--) {
    cin >> operation >> location;
    if (operation == 0) {
      if (location == k) {
        end = k;
      } else if (location < k) {
        end -= location;
        k -= location;
      } else {
        end -= (end - location);
      }
    } else {
      if (location <= k) {
        k++;
      }
      end++;
    }
    cout << end << " " << k << endl;
  }
}
