#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
const int MAX = 1e3 + 10;
char mat[MAX][MAX];
bool bb[MAX][MAX];
int n, m;
bool val(int i, int j) { return i >= 0 and j >= 0 and i < n and j < m; }
int splash(int i, int j) {
  int k = 1;
  while (val(i - k, j) and val(i + k, j) and val(i, j - k) and val(i, j + k) and
         mat[i - k][j] == '*' and mat[i + k][j] == '*' and
         mat[i][j - k] == '*' and mat[i][j + k] == '*')
    k++;
  return k - 1;
}
signed main() {
  int count = 0;
  scanf(" %d %d ", &n, &m);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      scanf(" %c", &mat[i][j]), count += mat[i][j] == '*';
  vector<pair<pair<int, int>, int> > ans;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (mat[i][j] == '*') {
        int x = splash(i, j);
        if (x) {
          count -= !bb[i][j];
          bb[i][j] = 1;
          ans.push_back({{i + 1, j + 1}, x});
          for (int k = 1; k <= x; k++) {
            bool &a = bb[i - k][j];
            bool &b = bb[i + k][j];
            bool &c = bb[i][j - k];
            bool &d = bb[i][j + k];
            count -= (!a + !b + !c + !d);
            a = b = c = d = 1;
          }
        }
      }
    }
  }
  if (!count) {
    printf("%d\n", (int)ans.size());
    for (auto x : ans)
      printf("%d %d %d\n", x.first.first, x.first.second, x.second);
    return 0;
  }
  printf("-1\n");
  return 0;
}
