func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int testCases = 1;     cin >> testCases;     while (testCases--) {       long long int n, m;       cin >> n >> m;       vector<string> array(n);       vector<pair<long long int, long long int>> sol;       for (int i = 0; i < n; ++i) cin >> array[i];       for (int i = 0; i < n - 1; ++i) {         for (int j = 0; j < m - 1; ++j) {           if (array[i][j] ==  0  && array[i][j + 1] ==  0 ) continue;           if (array[i][j] ==  1  && array[i][j + 1] ==  1 ) {             sol.push_back({i + 1, j + 1});             sol.push_back({i + 1, j + 2});             sol.push_back({i + 2, j + 1});             array[i][j] =  0 ;             array[i][j + 1] =  0 ;             if (array[i + 1][j] ==  0 )               array[i + 1][j] =  1 ;             else               array[i + 1][j] =  0 ;           } else if (array[i][j] ==  0  && array[i][j + 1] ==  1 ) {             sol.push_back({i + 1, j + 2});             sol.push_back({i + 2, j + 1});             sol.push_back({i + 2, j + 2});             array[i][j + 1] =  0 ;             if (array[i + 1][j] ==  0 )               array[i + 1][j] =  1 ;             else               array[i + 1][j] =  0 ;             if (array[i + 1][j + 1] ==  0 )               array[i + 1][j + 1] =  1 ;             else               array[i + 1][j + 1] =  0 ;           } else {             sol.push_back({i + 1, j + 1});             sol.push_back({i + 2, j + 1});             sol.push_back({i + 2, j + 2});             array[i][j] =  0 ;             if (array[i + 1][j] ==  0 )               array[i + 1][j] =  1 ;             else               array[i + 1][j] =  0 ;             if (array[i + 1][j + 1] ==  0 )               array[i + 1][j + 1] =  1 ;             else               array[i + 1][j + 1] =  0 ;           }         }       }       for (int j = 0; j < m - 1; ++j) {         if (array[n - 1][j] ==  0  && array[n - 1][j + 1] ==  0 ) continue;         if (array[n - 1][j] ==  0  && array[n - 1][j + 1] ==  1 ) {           sol.push_back({n - 1, j + 1});           sol.push_back({n - 1, j + 2});           sol.push_back({n, j + 2});           sol.push_back({n - 1, j + 2});           sol.push_back({n, j + 1});           sol.push_back({n, j + 2});           sol.push_back({n - 1, j + 1});           sol.push_back({n, j + 1});           sol.push_back({n, j + 2});           array[n - 1][j + 1] =  0 ;         } else if (array[n - 1][j] ==  1  && array[n - 1][j + 1] ==  0 ) {           sol.push_back({n - 1, j + 1});           sol.push_back({n - 1, j + 2});           sol.push_back({n, j + 1});           sol.push_back({n - 1, j + 2});           sol.push_back({n, j + 1});           sol.push_back({n, j + 2});           sol.push_back({n - 1, j + 1});           sol.push_back({n, j + 1});           sol.push_back({n, j + 2});           array[n - 1][j] =  0 ;         } else {           sol.push_back({n - 1, j + 1});           sol.push_back({n - 1, j + 2});           sol.push_back({n, j + 1});           sol.push_back({n - 1, j + 1});           sol.push_back({n - 1, j + 2});           sol.push_back({n, j + 2});           array[n - 1][j] = array[n - 1][j + 1] =  0 ;         }       }       cout << sol.size() / 3 << endl;       for (int i = 0; i < sol.size(); i += 3) {         cout << sol[i].first <<     << sol[i].second <<    ;         cout << sol[i + 1].first <<     << sol[i + 1].second <<    ;         cout << sol[i + 2].first <<     << sol[i + 2].second << endl;         ;       }     }   }   