#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y, r;
};
vector<node> ve;
const int N = 1005;
char ma[N][N];
bool vis[N][N];
int main() {
  memset(vis, 0, sizeof vis);
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> ma[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (ma[i][j] == '*') {
        int l = 0;
        while (ma[i + l][j] == '*' && ma[i - l][j] == '*' &&
               ma[i][j + l] == '*' && ma[i][j - l] == '*') {
          if (l > 0) {
            vis[i][j] = 1;
            vis[i + l][j] = 1;
            vis[i - l][j] = 1;
            vis[i][j + l] = 1;
            vis[i][j - l] = 1;
          }
          l++;
        }
        l--;
        if (l != 0) {
          node tmp;
          tmp.x = i;
          tmp.y = j;
          tmp.r = l;
          ve.push_back(tmp);
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (ma[i][j] == '*' && vis[i][j] == 0) {
        puts("-1");
        return 0;
      }
    }
  }
  cout << ve.size() << endl;
  for (int i = 0; i < ve.size(); i++) {
    cout << ve[i].x << " " << ve[i].y << " " << ve[i].r << endl;
  }
}
