func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 400000 + 5;   int n, m, tr[N << 2][3], q;   set<int> ssp[N][2];   void modify(int x, int who, int v, int l = 1, int r = n, int k = 1) {     if (l == r) {       if (ssp[l][who].count(v))         ssp[l][who].erase(v);       else         ssp[l][who].insert(v);       tr[k][0] = ssp[l][0].empty() ? 0x3f3f3f3f : *ssp[l][0].begin();       tr[k][1] = ssp[l][1].empty() ? 0 : *ssp[l][1].rbegin();       tr[k][2] = tr[k][1] >= tr[k][0];       return;     }     int mid = (l + r) >> 1;     if (x <= mid)       modify(x, who, v, l, mid, k << 1);     else       modify(x, who, v, mid + 1, r, k << 1 | 1);     tr[k][1] = max(tr[k << 1][1], tr[k << 1 | 1][1]);     tr[k][0] = min(tr[k << 1][0], tr[k << 1 | 1][0]);     tr[k][2] =         (tr[k << 1 | 1][1] >= tr[k << 1][0]) | tr[k << 1][2] | tr[k << 1 | 1][2];   }   void build(int l = 1, int r = n, int k = 1) {     tr[k][0] = 0x3f3f3f3f, tr[k][1] = tr[k][2] = 0;     if (l == r) return;     int mid = (l + r) >> 1;     build(l, mid, k << 1), build(mid + 1, r, k << 1 | 1);   }   int main() {     scanf( %d%d%d , &n, &m, &q);     n <<= 1, m <<= 1, build();     while (q--) {       int x, y;       scanf( %d%d , &x, &y);       if (x & 1) {         modify(x, 0, y);       } else {         --x, --y;         modify(x, 1, y);       }       printf( %s n , !tr[1][2] ?  YES  :  NO );     }     return 0;   }   