#include <bits/stdc++.h>   using ull = unsigned long long;   using ll = long long;   using ld = long double;   using namespace std;   const ll mod = 998244353;   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     int n, m, k, t;     cin >> n >> k >> m >> t;     deque<bool> cur(n);     cur[k - 1] = 1;     while (t--) {       int f, pos;       cin >> f >> pos;       if (f == 1) {         cur.insert(cur.begin() + (pos - 1), 0);         for (int i = 0; i < ((int)(cur).size()); i++) {           if (cur[i]) {             cout << ((int)(cur).size()) <<     << i + 1 <<   n ;             break;           }         }       } else {         int loc = -1;         for (int i = 0; i < ((int)(cur).size()); i++) {           if (cur[i]) {             loc = i + 1;             break;           }         }         if (loc <= pos)           while (((int)(cur).size()) > pos) cur.pop_back();         else           while (pos--) cur.pop_front();         for (int i = 0; i < ((int)(cur).size()); i++) {           if (cur[i]) {             cout << ((int)(cur).size()) <<     << i + 1 <<   n ;             break;           }         }       }     }     return 0;   }   