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  
    

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
struct str {
  long long int size = 0;
  vector<long long int> v;
  vector<long long int> pref;
  vector<long long int> suff;
  vector<long long int> max_sum;
  void init(long long int n) {
    size = 1;
    while (size < n) {
      size = size * 2;
    }
    v.assign(2 * size, 0LL);
    pref.assign(2 * size, 0LL);
    suff.assign(2 * size, 0LL);
    max_sum.assign(2 * size, 0LL);
  }
  void build(vector<long long int> &a, long long int x, long long int lx,
             long long int rx) {
    if (rx - lx == 1) {
      if (lx < a.size()) {
        v[x] = a[lx];
      }
      return;
    }
    build(a, 2 * x + 1, lx, (lx + rx) / 2);
    build(a, 2 * x + 2, (lx + rx) / 2, rx);
    v[x] = v[2 * x + 1] + v[2 * x + 2];
  }
  void set(long long int val, long long int i, long long int x,
           long long int lx, long long int rx) {
    if (rx - lx == 1) {
      v[x] = val;
      return;
    }
    if (i < (lx + rx) / 2) {
      set(val, i, 2 * x + 1, lx, (lx + rx) / 2);
    } else {
      set(val, i, 2 * x + 2, (lx + rx) / 2, rx);
    }
    v[x] = v[2 * x + 1] + v[2 * x + 2];
  }
  long long int sum(long long int l, long long int r, long long int x,
                    long long int lx, long long int rx) {
    if (lx >= r || l >= rx)
      return 0;
    else if (lx >= l && rx <= r)
      return v[x];
    else {
      long long int s1 = sum(l, r, 2 * x + 1, lx, (lx + rx) / 2);
      long long int s2 = sum(l, r, 2 * x + 2, (lx + rx) / 2, rx);
      return s1 + s2;
    }
  }
  long long int sum(long long int l, long long int r) {
    return sum(l, r, 0, 0, size);
  }
  void set(long long int l, long long int r) { set(l, r, 0, 0, size); }
};
template <typename T>
void __p(T a) {
  cout << "(" << a << ")";
}
template <typename T, typename F>
void __p(pair<T, F> a) {
  cout << "(";
  cout << a.first;
  cout << ",";
  cout << a.second;
  cout << ")";
}
template <typename T>
void __p(std::vector<T> a) {
  for (auto it = a.begin(); it < a.end(); it++) cout << *it << " ";
}
template <typename T>
void __p(std::set<T> a) {
  for (auto it = a.begin(); it != a.end(); it++) {
    cout << *it << " ";
  }
}
template <typename T>
void __p(std::multiset<T> a) {
  for (auto it = a.begin(); it != a.end(); it++) {
    cout << *it << " ";
  }
}
template <typename T, typename F>
void __p(std::map<T, F> a) {
  for (auto it = a.begin(); it != a.end(); ++it) {
    cout << it->first << " ";
    cout << it->second << " ";
    cout << "\n";
  }
}
template <typename T, typename... Arg>
void __p(T a1, Arg... a) {
  __p(a1);
  __p(a...);
}
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
  __p(arg1);
  cout << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args) {
  long long int bracket = 0, i = 0;
  for (;; i++)
    if (names[i] == ',' && bracket == 0)
      break;
    else if (names[i] == '(')
      bracket++;
    else if (names[i] == ')')
      bracket--;
  const char *comma = names + i;
  __p(arg1);
  cout << ",";
  __f(comma + 1, args...);
}
vector<bool> is_prime(100000 + 1, true);
void seive(long long int n) {
  is_prime[0] = is_prime[1] = false;
  for (long long int i = 2; i * i <= n; i++) {
    if (is_prime[i]) {
      for (long long int j = i * i; j <= n; j += i) is_prime[j] = false;
    }
  }
}
long long int get_inv(long long int x) {
  if (x <= 1) return 1;
  return (1000000007 - 1000000007 / x) * get_inv(1000000007 % x) % 1000000007;
}
long long int power(long long int a, long long int b,
                    long long int p = 1000000007) {
  long long int ans = 1;
  a = a % p;
  while (b > 0) {
    if (b % 2 == 1) {
      ans = (ans * a) % p;
    }
    b = b >> 1;
    a = (a * a) % p;
  }
  return ans;
}
void show(long long int *a, long long int n) {
  long long int size = n;
  for (long long int i = 0; i < size; i++) {
    cout << a[i] << " ";
  }
  cout << "\n";
}
long long int binary_search(long long int *a, long long int n,
                            long long int e) {
  long long int l = -1, r = n, m = 0;
  while (l + 1 < r) {
    m = (l + r) / 2;
    if (a[m] <= e) {
      l = m;
    } else {
      r = m;
    }
  }
  return l;
}
vector<long long int> fac(100001);
void fact() {
  fac[0] = 1;
  for (long long int i = 1; i < 100001; i++) {
    fac[i] = (fac[i - 1] * i) % 1000000007;
  }
}
bool cmp(const pair<long long int, long long int> &a,
         const pair<long long int, long long int> &b) {
  return (a.second < b.second);
}
class ans {
 public:
  pair<long long int, long long int> a[3];
};
void solve() {
  long long int n, m;
  cin >> n >> m;
  char c[n][m];
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; ++j) {
      cin >> c[i][j];
    }
  }
  vector<ans *> v;
  map<pair<long long int, long long int>, long long int> mp;
  for (long long int i = 0; i <= n - 1; i += 2) {
    for (long long int j = 0; j <= m - 1; j += 2) {
      if (i == n - 1) {
        i--;
      }
      if (j == m - 1) {
        j--;
      }
      vector<pair<long long int, long long int>> p0;
      vector<pair<long long int, long long int>> p1;
      long long int dx[4] = {0, 1, 0, 1};
      long long int dy[4] = {0, 0, 1, 1};
      for (long long int k = 0; k < 4; k++) {
        if ((c[i + dx[k]][j + dy[k]] == '1') &&
            mp[{i + dx[k], j + dy[k]}] != 1) {
          p1.push_back({i + dx[k], j + dy[k]});
        } else {
          p0.push_back({i + dx[k], j + dy[k]});
        }
        mp[{i + dx[k], j + dy[k]}] = 1;
      }
      if (p1.size() == 3) {
        auto x = new ans();
        x->a[0] = p1[0];
        x->a[1] = p1[1];
        x->a[2] = p1[2];
        v.push_back(x);
      } else if (p0.size() == 4) {
      } else if (p1.size() == 2) {
        auto x = new ans();
        x->a[0] = p1[0];
        x->a[1] = p0[0];
        x->a[2] = p0[1];
        v.push_back(x);
        auto y = new ans();
        y->a[0] = p1[1];
        y->a[1] = p0[0];
        y->a[2] = p0[1];
        v.push_back(y);
      } else if (p1.size() == 1) {
        auto x = new ans();
        x->a[0] = p1[0];
        x->a[1] = p0[0];
        x->a[2] = p0[1];
        v.push_back(x);
        auto y = new ans();
        y->a[0] = p1[0];
        y->a[1] = p0[0];
        y->a[2] = p0[2];
        v.push_back(y);
        auto z = new ans();
        z->a[0] = p1[0];
        z->a[1] = p0[1];
        z->a[2] = p0[2];
        v.push_back(z);
      } else if (p1.size() == 4) {
        auto x = new ans();
        x->a[0] = p1[0];
        x->a[1] = p1[1];
        x->a[2] = p1[2];
        v.push_back(x);
        auto y = new ans();
        y->a[0] = p1[1];
        y->a[1] = p1[2];
        y->a[2] = p1[3];
        v.push_back(y);
        auto z = new ans();
        z->a[0] = p1[0];
        z->a[1] = p1[1];
        z->a[2] = p1[3];
        v.push_back(z);
        auto w = new ans();
        w->a[0] = p1[0];
        w->a[1] = p1[2];
        w->a[2] = p1[3];
        v.push_back(w);
      }
    }
  }
  cout << v.size() << "\n";
  for (long long int i = 0; i < v.size(); ++i) {
    cout << v[i]->a[0].first + 1 << " " << v[i]->a[0].second + 1 << " "
         << v[i]->a[1].first + 1 << " " << v[i]->a[1].second + 1 << " "
         << v[i]->a[2].first + 1 << " " << v[i]->a[2].second + 1 << " "
         << "\n";
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(15);
  long long int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}