func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, k, a[105][105], m;   vector<pair<int, int> > ans;   void Solve2() {     int cur = 0, cnt = 0;     for (int i = n - 1; i <= n; ++i) {       for (int j = m - 1; j <= m; ++j) {         if (a[i][j] == 1 && cnt == 0) {           ans.push_back({i, j});           ++cnt;           a[i][j] ^= 1;         } else if (a[i][j] == 0 && cur < 2) {           ans.push_back({i, j});           cur++;           a[i][j] ^= 1;         }       }     }     for (int i = n - 1; i <= n; ++i) {       for (int j = m - 1; j <= m; ++j) {         if (a[i][j] == 1) ans.push_back({i, j});       }     }   }   void Solve1() {     int cur = 0;     for (int i = n - 1; i <= n; ++i) {       for (int j = m - 1; j <= m; ++j) {         if (a[i][j] == 1) {           ans.push_back({i, j});           a[i][j] ^= 1;         } else if (cur < 2) {           ans.push_back({i, j}), cur++;           a[i][j] ^= 1;         }       }     }     Solve2();   }   void Solve4() {     int cur = 0;     for (int i = n - 1; i <= n; ++i) {       for (int j = m - 1; j <= m; ++j) {         if (a[i][j] == 1) {           ans.push_back({i, j});           a[i][j] ^= 1;         }       }     }     Solve1();   }   void Handle() {     for (int i = 1; i < n - 1; ++i) {       for (int j = 1; j < m; ++j) {         if (a[i][j] == 1) {           a[i][j] ^= 1;           ans.push_back({i, j});           a[i + 1][j] ^= 1;           ans.push_back({i + 1, j});           a[i + 1][j + 1] ^= 1;           ans.push_back({i + 1, j + 1});         }       }       if (a[i][m] == 1) {         a[i][m] ^= 1;         ans.push_back({i, m});         a[i + 1][m] ^= 1;         ans.push_back({i + 1, m});         a[i + 1][m - 1] ^= 1;         ans.push_back({i + 1, m - 1});       }     }     for (int j = 1; j < m - 1; ++j) {       if (a[n - 1][j] == 1) {         a[n - 1][j] ^= 1;         ans.push_back({n - 1, j});         a[n - 1][j + 1] ^= 1;         ans.push_back({n - 1, j + 1});         a[n][j + 1] ^= 1;         ans.push_back({n, j + 1});       }       if (a[n][j] == 1) {         a[n][j] ^= 1;         ans.push_back({n, j});         a[n - 1][j + 1] ^= 1;         ans.push_back({n - 1, j + 1});         a[n][j + 1] ^= 1;         ans.push_back({n, j + 1});       }     }     int cnt = 0;     for (int i = n - 1; i <= n; ++i) {       for (int j = m - 1; j <= m; ++j) {         if (a[i][j] == 1) ++cnt;       }     }     if (cnt == 3) {       for (int i = n - 1; i <= n; ++i) {         for (int j = m - 1; j <= m; ++j) {           if (a[i][j] == 1) ans.push_back({i, j});         }       }       return;     }     if (cnt == 0) return;     if (cnt == 1) {       Solve1();       return;     }     if (cnt == 2) {       Solve2();       return;     }     if (cnt == 4) {       Solve4();       return;     }   }   void Solve() {     cin >> n >> m;     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= m; ++j) {         char x;         cin >> x;         a[i][j] = x -  0 ;       }     }     ans.clear();     Handle();     cout << ans.size() / 3 <<   n ;     for (int i = 0; i < ans.size(); i += 3) {       for (int j = 0; j <= 2; ++j)         cout << ans[i + j].first <<     << ans[i + j].second <<    ;       cout <<   n ;     }   }   int main() {     ios_base::sync_with_stdio(NULL);     cin.tie(NULL);     cout.tie(NULL);     if (fopen(                  .inp ,                r )) {       freopen(                         .inp ,            r , stdin);       freopen(                         .out ,            w , stdout);     }     int t;     cin >> t;     while (t--) {       Solve();     }     return 0;   }   