#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
char a[1010][1010];
bool vis[1010][1010];
stack<pair<int, pair<int, int> > > ans;
int n, m, t, x, y, s;
void bao() {
  int k, t;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      t = 0;
      for (k = 1; k <= min(n - i, i - 1) && k <= min(m - j, j - 1); k++)
        if (a[i][j] == '*' && a[i][j + k] == '*' && a[i][j - k] == '*' &&
            a[i + k][j] == '*' && a[i - k][j] == '*') {
          vis[i][j] = vis[i][j + k] = vis[i][j - k] = vis[i + k][j] =
              vis[i - k][j] = 1;
          t = k;
        } else
          break;
      if (t) {
        ans.push(make_pair(t, make_pair(i, j)));
      }
    }
  }
}
int main() {
  long long sum = 0;
  scanf("%d %d", &n, &m);
  while (ans.size()) ans.pop();
  for (int i = 1; i <= n; i++) scanf("%s", a[i] + 1);
  bao();
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (a[i][j] == '*' && vis[i][j] == 0) {
        puts("-1");
        return 0;
      }
    }
  }
  printf("%d\n", ans.size());
  while (ans.size()) {
    int s = ans.top().first;
    pair<int, int> x = ans.top().second;
    ans.pop();
    printf("%d %d %d\n", x.first, x.second, s);
  }
  return 0;
}
