func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, q;   int b[100000][2];   int a[100000];   int c[5];   int main() {     cin >> n >> q;     for (int i = 0; i < n; i++) {       b[i][0] = 0;       b[i][1] = 0;       a[i] = 0;     }     c[0] = n - 1;     int s = 0;     for (int i = 0; i < q; i++) {       int y, x;       cin >> x >> y;       x--;       y--;       if (b[y][x] == 1) {         if (y == 0) {           if (b[y + 1][x] == 1) s--;           c[a[y]]--;           a[y]--;           c[a[y]]++;         } else if (y == n - 1) {           if (b[y - 1][x] == 1) s--;           c[a[y - 1]]--;           a[y - 1]--;           c[a[y - 1]]++;         } else {           if (b[y - 1][x] == 1) s--;           if (b[y + 1][x] == 1) s--;           c[a[y - 1]]--;           a[y - 1]--;           c[a[y - 1]]++;           c[a[y]]--;           a[y]--;           c[a[y]]++;         }         b[y][x] = 0;       } else {         if (y == 0) {           if (b[y + 1][x] == 1) s++;           c[a[y]]--;           a[y]++;           c[a[y]]++;         } else if (y == n - 1) {           if (b[y - 1][x] == 1) s++;           c[a[y - 1]]--;           a[y - 1]++;           c[a[y - 1]]++;         } else {           if (b[y + 1][x] == 1) s++;           if (b[y - 1][x] == 1) s++;           c[a[y - 1]]--;           a[y - 1]++;           c[a[y - 1]]++;           c[a[y]]--;           a[y]++;           c[a[y]]++;         }         b[y][x] = 1;       }       if (c[4] == 0 && c[3] == 0 && c[2] - s <= 0)         cout <<  Yes  << endl;       else         cout <<  No  << endl;     }   }   