#include <bits/stdc++.h>   using namespace std;   long long add(long long a, long long b, long long mod) {     return (a % mod + b % mod) % mod;   }   long long sub(long long a, long long b, long long mod) {     return (a % mod - b % mod + mod) % mod;   }   long long mul(long long a, long long b, long long mod) {     return (a % mod * b % mod) % mod;   }   long long sumodd(long long num, long long mod) { return mul(num, num, mod); }   long long sumeven(long long num, long long mod) {     return mul(num, num + 1, mod);   }   long long sumrange(long long st, long long en, long long num) {     return (num * (st + en) / 2);   }   long long gcd(long long a, long long b) {     while (b != 0) {       long long a2 = a;       a = b;       b = a2 % b;     }     return a;   }   long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }   string makeitbinary(long long n) {     string s;     while (n) {       s = s + (char)((n % 2) +  0 );       n /= 2;     }     reverse(s.begin(), s.end());     return s;   }   bool bit(int num, int i) { return ((num >> i) & 1); }   long long fastpowermod(long long b, long long p, long long mod) {     long long ans = 1;     while (p) {       if (p % 2) {         ans = mul(ans, b, mod);       }       b = mul(b, b, mod);       p /= 2;     }     return ans;   }   long long fastpower(long long b, long long p) {     long long ans = 1;     while (p) {       if (p % 2) {         ans = ans * b;       }       b = b * b;       p /= 2;     }     return ans;   }   double fastpower_double(double b, long long p) {     double ans = 1;     while (p) {       if (p % 2) {         ans = ans * b;       }       b = b * b;       p /= 2;     }     return ans;   }   long long summation_formula(long long n) { return (n * (n + 1) / 2); }   bool lower_vowel(char c) {     return (c ==  i  || c ==  o  || c ==  u  || c ==  a  || c ==  e );   }   string bigint_mini(string s1, string s2) {     if (s1.size() > s2.size()) {       return s2;     } else if (s2.size() > s1.size()) {       return s1;     }     for (int i = 0; i < s1.size(); i++) {       if ((s1[i] -  0 ) > (s2[i] -  0 )) {         return s2;       } else if ((s2[i] -  0 ) > (s1[i] -  0 )) {         return s1;       }     }     return s1;   }   double polygon_area(int n, vector<double> X, vector<double> Y) {     double area = 0.0;     int j = n - 1;     for (int i = 0; i < n; i++) {       area += (X[j] + X[i]) * (Y[j] - Y[i]);       j = i;     }     return abs(area / 2.0);   }   long long sum_of_digits(string s) {     long long sum = 0;     for (int i = 0; i < s.size(); i++) {       sum += s[i] -  0 ;     }     return sum;   }   string makeitbase(long long num, long long base) {     string s;     while (num) {       long long mod = num % base;       s += (mod +  0 );       num /= base;     }     reverse(s.begin(), s.end());     return s;   }   bool intersect(long long l1, long long r1, long long l2, long long r2) {     return (max(l1, l2) <= min(r1, r2));   }   pair<long long, long long> find_intersection(long long l1, long long r1,                                                long long l2, long long r2) {     return {max(l1, l2), min(r1, r2)};   }   long long sum_ranges(long long l, long long r) {     return summation_formula(r) - summation_formula(l);   }   double power_2(double num) { return num * num; }   struct point {     int x, y;   };   long long dist(point p1, point p2) {     return (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y);   }   bool square(point p1, point p2, point p3, point p4) {     long long d2 = dist(p1, p2);     long long d3 = dist(p1, p3);     long long d4 = dist(p1, p4);     if (d2 == d3 && 2 * d2 == d4 && 2 * dist(p2, p4) == dist(p2, p3)) {       return true;     }     if (d3 == d4 && 2 * d3 == d2 && 2 * dist(p3, p2) == dist(p3, p4)) {       return true;     }     if (d2 == d4 && 2 * d2 == d3 && 2 * dist(p2, p3) == dist(p2, p4)) {       return true;     }     return false;   }   const int sz = 1e6 + 1;   long long M = 1e9 + 7;   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     int n, k, m, t;     cin >> n >> k >> m >> t;     while (t--) {       int x, y;       cin >> x >> y;       if (x == 1) {         if (y <= k) {           k++;         }         n++;       } else {         if (k >= 1 && k <= y) {           n -= (n - y);         } else {           n -= y;           k -= y;         }       }       cout << n <<     << k << endl;     }     return 0;   }