#include <bits/stdc++.h>
const long double eps = 0.00000001;
const long long MOD = 1e9 + 7;
const double PI = 3.141592653589793238463;
using namespace std;
long long ans;
int was[1010][1010];
int main() {
  fflush(stdin);
  cout << fixed, cout.precision(18);
  ios_base::sync_with_stdio(false);
  int i, j, n, m;
  cin >> n >> m;
  string second[n];
  for (i = 0; i < n; ++i) cin >> second[i];
  vector<pair<pair<int, int>, int>> ve;
  for (i = 1; i < n - 1; ++i) {
    for (j = 1; j < m - 1; ++j) {
      if (second[i][j] == '.') continue;
      int max_len = min(min(i, n - i - 1), min(j, m - j - 1));
      if (max_len == 0) continue;
      int x = i, y = j;
      for (int len = 1; len <= max_len; ++len) {
        if (second[i + len][j] == '*' && second[i - len][j] == '*' &&
            second[i][j - len] == '*' && second[i][j + len] == '*') {
          was[i][j] = 1;
          was[i + len][j] = was[i - len][j] = was[i][j - len] =
              was[i][j + len] = 1;
          if (len == max_len) ve.push_back({{i + 1, j + 1}, len});
          continue;
        }
        if (len - 1 > 0) ve.push_back({{i + 1, j + 1}, len - 1});
        break;
      }
    }
  }
  bool b = true;
  for (i = 0; i < n; ++i)
    for (j = 0; j < m; ++j)
      if (second[i][j] == '*' && !was[i][j]) b = false;
  if (!b) return cout << -1, 0;
  cout << ve.size() << endl;
  for (i = 0; i < ve.size(); ++i) {
    printf("%d %d %d\n", ve[i].first.first, ve[i].first.second, ve[i].second);
  }
}
