#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
vector<pair<int, pair<int, int>>> v(10 * 100005);
char ch[1001][1001];
char ans[1001][1001];
int res = 0;
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> ans[i][j];
      ch[i][j] = '.';
    }
  }
  for (int i = 1; i < n - 1; i++) {
    for (int j = 1; j < m - 1; j++) {
      int maxl = min(min(n - 1 - i, i), min(j, m - 1 - j));
      int k = 1;
      bool flag = false;
      while (k <= maxl) {
        if (ans[i][j] == '*' && ans[i][j - k] == '*' && ans[i][j + k] == '*' &&
            ans[i - k][j] == '*' && ans[i + k][j] == '*') {
          ch[i][j] = '*';
          ch[i][j - k] = '*';
          ch[i][j + k] = '*';
          ch[i - k][j] = '*';
          ch[i + k][j] = '*';
          flag = true;
          k++;
        } else
          break;
      }
      if (flag) {
        v[++res] = make_pair(i + 1, make_pair(j + 1, k - 1));
      }
    }
  }
  bool flag = true;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (ch[i][j] != ans[i][j]) {
        flag = false;
        break;
      }
    }
    if (!flag) break;
  }
  if (flag) {
    printf("%d\n", res);
    for (int i = 1; i <= res; i++) {
      printf("%d %d %d\n", v[i].first, v[i].second.first, v[i].second.second);
    }
  } else
    cout << -1;
  return 0;
}
