#include <bits/stdc++.h>
using namespace std;
char c[1005][1005];
int vis[1005][1005];
int n, m;
struct Node {
  int x, y, index;
} node[1000005];
int pos = 0;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%s", &c[i]);
  }
  for (int i = 1; i < n - 1; i++) {
    for (int j = 1; j < m - 1; j++) {
      if (c[i][j] == '*') {
        int cnt = 1;
        bool flag = true;
        while (flag) {
          int xx = i, yy = j;
          if (xx - cnt >= 0 && xx + cnt < n && yy - cnt >= 0 && yy + cnt < m) {
            if (c[xx - cnt][yy] != '*' || c[xx + cnt][yy] != '*' ||
                c[xx][yy - cnt] != '*' || c[xx][yy + cnt] != '*') {
              flag = false;
            } else {
              vis[xx - cnt][yy] = vis[xx + cnt][yy] = vis[xx][yy - cnt] =
                  vis[xx][yy + cnt] = 1;
            }
          } else {
            flag = false;
          }
          if (flag) cnt++;
        }
        if (cnt > 1) {
          node[pos].x = i + 1;
          node[pos].y = j + 1;
          node[pos++].index = cnt - 1;
          vis[i][j] = 1;
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (c[i][j] == '*' && vis[i][j] == 0) {
        printf("-1\n");
        return 0;
      }
    }
  }
  printf("%d\n", pos);
  for (int i = 0; i < pos; i++) {
    printf("%d %d %d\n", node[i].x, node[i].y, node[i].index);
  }
  return 0;
}
