#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using ld = long double;
vector<int> graph[100001];
int main() {
  int t1 = 1;
  while (t1--) {
    int n, k, m, t;
    cin >> n >> k >> m >> t;
    vector<int> v(n);
    for (int i = 1; i <= n; i++) v[i - 1] = i;
    int next = n + 1;
    while (t--) {
      int x, index;
      cin >> x >> index;
      if (x == 0) {
        vector<int> temp;
        if (index < k) {
          k -= index;
          for (int i = index; i < n; i++) temp.push_back(v[i]);
        } else {
          for (int i = 0; i < index; i++) temp.push_back(v[i]);
        }
        v.clear();
        v = temp;
        n = v.size();
        cout << n << " " << k << endl;
      } else {
        vector<int> temp;
        for (int i = 0; i < n; i++) {
          if (i + 1 == index) {
            temp.push_back(next);
          }
          temp.push_back(v[i]);
        }
        if (index > n) temp.push_back(next);
        next++;
        v.clear();
        for (auto it : temp) v.push_back(it);
        n = v.size();
        if (index <= k) k++;
        cout << n << " " << k << endl;
      }
    }
  }
  return 0;
}
