#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
long long int mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
pair<long long int, long long int> fib(long long int n) {
  if (n == 0) return {0, 1};
  auto p = fib(n >> 1);
  long long int c = p.first * (2 * p.second - p.first);
  long long int d = p.first * p.first + p.second * p.second;
  if (n & 1)
    return {d, c + d};
  else
    return {c, d};
}
long long int fact(long long int n) {
  long long int res = 1;
  for (long long int i = n; i >= 1; i--) (res *= i) %= mod;
  return (res % mod);
}
long long int power(long long int a, long long int b, long long int m) {
  long long int ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return ans;
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  for (long long i = 2; i <= sqrt(n); i++)
    if (n % i == 0) return false;
  return true;
}
vector<long long> segmentedSieve(long long L, long long R) {
  long long lim = sqrt(R);
  vector<bool> mark(lim + 1, false);
  vector<long long> primes;
  for (long long i = 2; i <= lim; ++i) {
    if (!mark[i]) {
      primes.emplace_back(i);
      for (long long j = i * i; j <= lim; j += i) mark[j] = true;
    }
  }
  vector<bool> isPrime(R - L + 1, true);
  for (long long i : primes)
    for (long long j = max(i * i, (L + i - 1) / i * i); j <= R; j += i)
      isPrime[j - L] = false;
  if (L == 1) isPrime[0] = false;
  vector<long long> realprime;
  for (long long int i = 0; i <= R - L; i++) {
    if (isPrime[i]) {
      realprime.emplace_back(i + L);
    }
  }
  return realprime;
}
bool isPalindrome(string s) {
  long long int l = 0;
  long long int h = s.size() - 1;
  while (h > l) {
    if (s[l++] != s[h--]) {
      return false;
    }
  }
  return true;
}
long long int ternarySearch(long long int l, long long int r, long long int key,
                            long long int ar[]) {
  while (r >= l) {
    long long int mid1 = l + (r - l) / 3;
    long long int mid2 = r - (r - l) / 3;
    if (ar[mid1] == key) {
      return mid1;
    }
    if (ar[mid2] == key) {
      return mid2;
    }
    if (key < ar[mid1]) {
      r = mid1 - 1;
    } else if (key > ar[mid2]) {
      l = mid2 + 1;
    } else {
      l = mid1 + 1;
      r = mid2 - 1;
    }
  }
  return -1;
}
long long int binarySearch(long long int arr[], long long int l,
                           long long int r, long long int x) {
  while (l <= r) {
    long long int m = l + (r - l) / 2;
    if (arr[m] == x) return m;
    if (arr[m] < x)
      l = m + 1;
    else
      r = m - 1;
  }
  return -1;
}
long long maxsubarraysum(long long *array, long long n) {
  long long best = 0, sum = 0;
  for (long long k = 0; k < n; k++) {
    sum = max(array[k], sum + array[k]);
    best = max(best, sum);
  }
  return best;
}
string findSum(string str1, string str2) {
  if (str1.length() > str2.length()) swap(str1, str2);
  string str = "";
  long long int n1 = str1.length(), n2 = str2.length();
  reverse(str1.begin(), str1.end());
  reverse(str2.begin(), str2.end());
  long long int carry = 0;
  for (long long int i = 0; i < n1; i++) {
    long long int sum = ((str1[i] - '0') + (str2[i] - '0') + carry);
    str.push_back(sum % 10 + '0');
    carry = sum / 10;
  }
  for (long long int i = n1; i < n2; i++) {
    long long int sum = ((str2[i] - '0') + carry);
    str.push_back(sum % 10 + '0');
    carry = sum / 10;
  }
  if (carry) str.push_back(carry + '0');
  reverse(str.begin(), str.end());
  return str;
}
string smin(string a, string b) {
  if (a.size() < b.size()) return a;
  if (a.size() > b.size()) return b;
  if (a <= b)
    return a;
  else
    return b;
}
bool so(const pair<long long int, long long int> &a,
        const pair<long long int, long long int> &b) {
  return (a.second < b.second);
}
long long int setBitNumber(long long int n) {
  n |= n >> 1;
  n |= n >> 2;
  n |= n >> 4;
  n |= n >> 8;
  n |= n >> 16;
  n = n + 1;
  return (n >> 1);
}
bool CompareVector(vector<string> first, vector<string> second) {
  if (first[0] < second[0]) return true;
  if (first[1] < second[1]) return true;
  if (first[2] < second[2]) return true;
  return false;
}
unsigned countBits(unsigned long long int number) {
  return (long long int)log2(number) + 1;
}
long long int mul(long long int a, long long int b) { return (a * b) % mod; }
void addmod(long long int &a, long long int b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}
long long int myXOR(long long int x, long long int y) {
  long long int res = 0;
  for (long long int i = 31; i >= 0; i--) {
    bool b1 = x & (1 << i);
    bool b2 = y & (1 << i);
    bool xoredBit = (b1 & b2) ? 0 : (b1 | b2);
    res <<= 1;
    res |= xoredBit;
  }
  return res;
}
long long int nCr(long long int n, long long int r) {
  return (fact(n)) / (fact(r) * fact(n - r));
}
vector<long long int> v[100005];
pair<long long int, long long int> dfs(long long int node) {
  long long int mex = 0;
  long long int size = 1;
  for (long long int u : v[node]) {
    auto temp = dfs(u);
    mex = max(mex, temp.first);
    size += temp.second;
  }
  return {mex + size, size};
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, m;
    cin >> n >> m;
    char b[n + 1][m + 1];
    long long int a[n + 1][m + 1];
    for (long long int i = 1; i <= n; i++) {
      for (long long int j = 1; j <= m; j++) {
        cin >> b[i][j];
        a[i][j] = b[i][j] - '0';
      }
    }
    vector<pair<long long int, long long int>> v;
    for (long long int i = 1; i < n; i++) {
      for (long long int j = 1; j <= m; j++) {
        if (a[i][j] == 1 && j < m) {
          v.push_back({i, j});
          v.push_back({i + 1, j});
          v.push_back({i + 1, j + 1});
          a[i][j] = 0;
          a[i + 1][j] = (a[i + 1][j]) ^ 1;
          a[i + 1][j + 1] = a[i + 1][j + 1] ^ 1;
        }
        if (a[i][j] == 1 && j == m) {
          v.push_back({i, j});
          v.push_back({i + 1, j});
          v.push_back({i + 1, j - 1});
          a[i][j] = 0;
          a[i + 1][j] = a[i + 1][j] ^ 1;
          a[i + 1][j - 1] = a[i + 1][j - 1] ^ 1;
        }
      }
    }
    for (long long int j = 1; j < m; j++) {
      if (a[n][j] == 1) {
        v.push_back({n, j});
        v.push_back({n - 1, j});
        v.push_back({n - 1, j + 1});
        v.push_back({n, j + 1});
        v.push_back({n - 1, j});
        v.push_back({n - 1, j + 1});
        a[n][j] = 0;
        a[n - 1][j] = a[n - 1][j] ^ 1;
        a[n - 1][j + 1] = a[n - 1][j + 1] ^ 1;
        a[n][j + 1] = a[n][j + 1] ^ 1;
        a[n - 1][j] = a[n - 1][j] ^ 1;
        a[n - 1][j + 1] = a[n - 1][j + 1] ^ 1;
      }
    }
    if (a[n][m] == 1) {
      v.push_back({n, m});
      v.push_back({n - 1, m});
      v.push_back({n - 1, m - 1});
      v.push_back({n - 1, m - 1});
      v.push_back({n, m - 1});
      v.push_back({n, m});
      v.push_back({n, m - 1});
      v.push_back({n, m});
      v.push_back({n - 1, m});
      a[n][m] = 0;
      a[n - 1][m] = a[n - 1][m] ^ 1;
      a[n - 1][m - 1] = a[n - 1][m - 1] ^ 1;
      a[n - 1][m - 1] = a[n - 1][m - 1] ^ 1;
      a[n][m - 1] = a[n][m - 1] ^ 1;
      a[n][m] = a[n][m] ^ 1;
      a[n][m - 1] = a[n][m - 1] ^ 1;
      a[n][m] = a[n][m] ^ 1;
      a[n - 1][m] = a[n - 1][m] ^ 1;
    }
    cout << v.size() / 3 << "\n";
    long long int c = 0;
    for (long long int i = 0; i < v.size(); i++) {
      cout << v[i].first << " " << v[i].second << " ";
      c++;
      if (c == 3) {
        cout << "\n";
        c = 0;
      }
    }
  }
  return 0;
}

### Prompt

In CPP, your task is to solve the following problem:

This is the easy version of the problem. The difference between the versions is in the number of possible operations that can be made. You can make hacks if and only if you solved both versions of the problem.

You are given a binary table of size n × m. This table consists of symbols 0 and 1.

You can make such operation: select 3 different cells that belong to one 2 × 2 square and change the symbols in these cells (change 0 to 1 and 1 to 0).

Your task is to make all symbols in the table equal to 0. You are allowed to make at most 3nm operations. You don't need to minimize the number of operations.

It can be proved that it is always possible.

Input

The first line contains a single integer t (1 ≤ t ≤ 5000) — the number of test cases. The next lines contain descriptions of test cases.

The first line of the description of each test case contains two integers n, m (2 ≤ n, m ≤ 100).

Each of the next n lines contains a binary string of length m, describing the symbols of the next row of the table.

It is guaranteed that the sum of nm for all test cases does not exceed 20000.

Output

For each test case print the integer k (0 ≤ k ≤ 3nm) — the number of operations.

In the each of the next k lines print 6 integers x_1, y_1, x_2, y_2, x_3, y_3 (1 ≤ x_1, x_2, x_3 ≤ n, 1 ≤ y_1, y_2, y_3 ≤ m) describing the next operation. This operation will be made with three cells (x_1, y_1), (x_2, y_2), (x_3, y_3). These three cells should be different. These three cells should belong into some 2 × 2 square.

Example

Input


5
2 2
10
11
3 3
011
101
110
4 4
1111
0110
0110
1111
5 5
01011
11001
00010
11011
10000
2 3
011
101


Output


1
1 1 2 1 2 2
2 
2 1 3 1 3 2
1 2 1 3 2 3
4
1 1 1 2 2 2 
1 3 1 4 2 3
3 2 4 1 4 2
3 3 4 3 4 4
4
1 2 2 1 2 2 
1 4 1 5 2 5 
4 1 4 2 5 1
4 4 4 5 3 4
2
1 3 2 2 2 3
1 2 2 1 2 2

Note

In the first test case, it is possible to make only one operation with cells (1, 1), (2, 1), (2, 2). After that, all symbols will be equal to 0.

In the second test case:

  * operation with cells (2, 1), (3, 1), (3, 2). After it the table will be: 
    
          
    011  
    001  
    000  
    

  * operation with cells (1, 2), (1, 3), (2, 3). After it the table will be: 
    
          
    000  
    000  
    000  
    




In the fifth test case:

  * operation with cells (1, 3), (2, 2), (2, 3). After it the table will be: 
    
          
    010  
    110  
    

  * operation with cells (1, 2), (2, 1), (2, 2). After it the table will be: 
    
          
    000  
    000  
    

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
long long int mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
pair<long long int, long long int> fib(long long int n) {
  if (n == 0) return {0, 1};
  auto p = fib(n >> 1);
  long long int c = p.first * (2 * p.second - p.first);
  long long int d = p.first * p.first + p.second * p.second;
  if (n & 1)
    return {d, c + d};
  else
    return {c, d};
}
long long int fact(long long int n) {
  long long int res = 1;
  for (long long int i = n; i >= 1; i--) (res *= i) %= mod;
  return (res % mod);
}
long long int power(long long int a, long long int b, long long int m) {
  long long int ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return ans;
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  for (long long i = 2; i <= sqrt(n); i++)
    if (n % i == 0) return false;
  return true;
}
vector<long long> segmentedSieve(long long L, long long R) {
  long long lim = sqrt(R);
  vector<bool> mark(lim + 1, false);
  vector<long long> primes;
  for (long long i = 2; i <= lim; ++i) {
    if (!mark[i]) {
      primes.emplace_back(i);
      for (long long j = i * i; j <= lim; j += i) mark[j] = true;
    }
  }
  vector<bool> isPrime(R - L + 1, true);
  for (long long i : primes)
    for (long long j = max(i * i, (L + i - 1) / i * i); j <= R; j += i)
      isPrime[j - L] = false;
  if (L == 1) isPrime[0] = false;
  vector<long long> realprime;
  for (long long int i = 0; i <= R - L; i++) {
    if (isPrime[i]) {
      realprime.emplace_back(i + L);
    }
  }
  return realprime;
}
bool isPalindrome(string s) {
  long long int l = 0;
  long long int h = s.size() - 1;
  while (h > l) {
    if (s[l++] != s[h--]) {
      return false;
    }
  }
  return true;
}
long long int ternarySearch(long long int l, long long int r, long long int key,
                            long long int ar[]) {
  while (r >= l) {
    long long int mid1 = l + (r - l) / 3;
    long long int mid2 = r - (r - l) / 3;
    if (ar[mid1] == key) {
      return mid1;
    }
    if (ar[mid2] == key) {
      return mid2;
    }
    if (key < ar[mid1]) {
      r = mid1 - 1;
    } else if (key > ar[mid2]) {
      l = mid2 + 1;
    } else {
      l = mid1 + 1;
      r = mid2 - 1;
    }
  }
  return -1;
}
long long int binarySearch(long long int arr[], long long int l,
                           long long int r, long long int x) {
  while (l <= r) {
    long long int m = l + (r - l) / 2;
    if (arr[m] == x) return m;
    if (arr[m] < x)
      l = m + 1;
    else
      r = m - 1;
  }
  return -1;
}
long long maxsubarraysum(long long *array, long long n) {
  long long best = 0, sum = 0;
  for (long long k = 0; k < n; k++) {
    sum = max(array[k], sum + array[k]);
    best = max(best, sum);
  }
  return best;
}
string findSum(string str1, string str2) {
  if (str1.length() > str2.length()) swap(str1, str2);
  string str = "";
  long long int n1 = str1.length(), n2 = str2.length();
  reverse(str1.begin(), str1.end());
  reverse(str2.begin(), str2.end());
  long long int carry = 0;
  for (long long int i = 0; i < n1; i++) {
    long long int sum = ((str1[i] - '0') + (str2[i] - '0') + carry);
    str.push_back(sum % 10 + '0');
    carry = sum / 10;
  }
  for (long long int i = n1; i < n2; i++) {
    long long int sum = ((str2[i] - '0') + carry);
    str.push_back(sum % 10 + '0');
    carry = sum / 10;
  }
  if (carry) str.push_back(carry + '0');
  reverse(str.begin(), str.end());
  return str;
}
string smin(string a, string b) {
  if (a.size() < b.size()) return a;
  if (a.size() > b.size()) return b;
  if (a <= b)
    return a;
  else
    return b;
}
bool so(const pair<long long int, long long int> &a,
        const pair<long long int, long long int> &b) {
  return (a.second < b.second);
}
long long int setBitNumber(long long int n) {
  n |= n >> 1;
  n |= n >> 2;
  n |= n >> 4;
  n |= n >> 8;
  n |= n >> 16;
  n = n + 1;
  return (n >> 1);
}
bool CompareVector(vector<string> first, vector<string> second) {
  if (first[0] < second[0]) return true;
  if (first[1] < second[1]) return true;
  if (first[2] < second[2]) return true;
  return false;
}
unsigned countBits(unsigned long long int number) {
  return (long long int)log2(number) + 1;
}
long long int mul(long long int a, long long int b) { return (a * b) % mod; }
void addmod(long long int &a, long long int b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}
long long int myXOR(long long int x, long long int y) {
  long long int res = 0;
  for (long long int i = 31; i >= 0; i--) {
    bool b1 = x & (1 << i);
    bool b2 = y & (1 << i);
    bool xoredBit = (b1 & b2) ? 0 : (b1 | b2);
    res <<= 1;
    res |= xoredBit;
  }
  return res;
}
long long int nCr(long long int n, long long int r) {
  return (fact(n)) / (fact(r) * fact(n - r));
}
vector<long long int> v[100005];
pair<long long int, long long int> dfs(long long int node) {
  long long int mex = 0;
  long long int size = 1;
  for (long long int u : v[node]) {
    auto temp = dfs(u);
    mex = max(mex, temp.first);
    size += temp.second;
  }
  return {mex + size, size};
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, m;
    cin >> n >> m;
    char b[n + 1][m + 1];
    long long int a[n + 1][m + 1];
    for (long long int i = 1; i <= n; i++) {
      for (long long int j = 1; j <= m; j++) {
        cin >> b[i][j];
        a[i][j] = b[i][j] - '0';
      }
    }
    vector<pair<long long int, long long int>> v;
    for (long long int i = 1; i < n; i++) {
      for (long long int j = 1; j <= m; j++) {
        if (a[i][j] == 1 && j < m) {
          v.push_back({i, j});
          v.push_back({i + 1, j});
          v.push_back({i + 1, j + 1});
          a[i][j] = 0;
          a[i + 1][j] = (a[i + 1][j]) ^ 1;
          a[i + 1][j + 1] = a[i + 1][j + 1] ^ 1;
        }
        if (a[i][j] == 1 && j == m) {
          v.push_back({i, j});
          v.push_back({i + 1, j});
          v.push_back({i + 1, j - 1});
          a[i][j] = 0;
          a[i + 1][j] = a[i + 1][j] ^ 1;
          a[i + 1][j - 1] = a[i + 1][j - 1] ^ 1;
        }
      }
    }
    for (long long int j = 1; j < m; j++) {
      if (a[n][j] == 1) {
        v.push_back({n, j});
        v.push_back({n - 1, j});
        v.push_back({n - 1, j + 1});
        v.push_back({n, j + 1});
        v.push_back({n - 1, j});
        v.push_back({n - 1, j + 1});
        a[n][j] = 0;
        a[n - 1][j] = a[n - 1][j] ^ 1;
        a[n - 1][j + 1] = a[n - 1][j + 1] ^ 1;
        a[n][j + 1] = a[n][j + 1] ^ 1;
        a[n - 1][j] = a[n - 1][j] ^ 1;
        a[n - 1][j + 1] = a[n - 1][j + 1] ^ 1;
      }
    }
    if (a[n][m] == 1) {
      v.push_back({n, m});
      v.push_back({n - 1, m});
      v.push_back({n - 1, m - 1});
      v.push_back({n - 1, m - 1});
      v.push_back({n, m - 1});
      v.push_back({n, m});
      v.push_back({n, m - 1});
      v.push_back({n, m});
      v.push_back({n - 1, m});
      a[n][m] = 0;
      a[n - 1][m] = a[n - 1][m] ^ 1;
      a[n - 1][m - 1] = a[n - 1][m - 1] ^ 1;
      a[n - 1][m - 1] = a[n - 1][m - 1] ^ 1;
      a[n][m - 1] = a[n][m - 1] ^ 1;
      a[n][m] = a[n][m] ^ 1;
      a[n][m - 1] = a[n][m - 1] ^ 1;
      a[n][m] = a[n][m] ^ 1;
      a[n - 1][m] = a[n - 1][m] ^ 1;
    }
    cout << v.size() / 3 << "\n";
    long long int c = 0;
    for (long long int i = 0; i < v.size(); i++) {
      cout << v[i].first << " " << v[i].second << " ";
      c++;
      if (c == 3) {
        cout << "\n";
        c = 0;
      }
    }
  }
  return 0;
}

```