#include <bits/stdc++.h>
using namespace std;
char m[1005][1005];
int sor[4], a, b, total = 0, tot = 0, cou = 0, flag = 0, f = 0;
int ans[10005], ansi[10005], ansj[10005], stri[10005], strj[10005];
signed main() {
  cin >> a >> b;
  for (int i = 1; i <= a; i++)
    for (int j = 1; j <= b; j++) {
      cin >> m[i][j];
      if (m[i][j] == '*') {
        stri[flag] = i;
        strj[flag] = j;
        flag++;
      }
    }
  int aa = 0, bb = 0, cc = 0, dd = 0;
  for (int i = 0; i < flag; i++) {
    aa = 0;
    tot = 1;
    while ((m[stri[i]][strj[i] - tot] == '*' ||
            m[stri[i]][strj[i] - tot] == '#') &&
           (m[stri[i]][strj[i] + tot] == '*' ||
            m[stri[i]][strj[i] + tot] == '#') &&
           (m[stri[i] + tot][strj[i]] == '*' ||
            m[stri[i] + tot][strj[i]] == '#') &&
           (m[stri[i] - tot][strj[i]] == '*' ||
            m[stri[i] - tot][strj[i]] == '#')) {
      m[stri[i] + tot][strj[i]] = '#';
      m[stri[i] - tot][strj[i]] = '#';
      m[stri[i]][strj[i] + tot] = '#';
      m[stri[i]][strj[i] - tot] = '#';
      m[stri[i]][strj[i]] = '#';
      tot++;
      aa++;
    }
    ansi[f] = stri[i];
    ansj[f] = strj[i];
    ans[f] = aa;
    f++;
  }
  int deter = 0;
  for (int i = 1; i <= a; i++) {
    for (int j = 1; j <= b; j++) {
      if (m[i][j] == '*') {
        deter = 1;
      }
    }
  }
  int co = 0;
  if (deter) return cout << -1, 0;
  for (int i = 0; i < f; i++) {
    if (ans[i] != 0) co++;
  }
  cout << co << endl;
  for (int i = 0; i < f; i++) {
    if (ans[i] != 0) cout << ansi[i] << " " << ansj[i] << " " << ans[i] << endl;
  }
  return 0;
}
