#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 7;
int n;
int m;
char a[N][N];
int used[N][N];
int can(int x, int y) {
  return (x > 0 && y > 0 && x <= n && y <= m && a[x][y] == '*');
}
int f(int x, int y) {
  int cnt = 1;
  while (true) {
    if (!can(x + cnt, y) || !can(x - cnt, y) || !can(x, y + cnt) ||
        !can(x, y - cnt))
      break;
    used[x + cnt][y] = 1;
    used[x - cnt][y] = 1;
    used[x][y + cnt] = 1;
    used[x][y - cnt] = 1;
    cnt++;
  }
  return cnt - 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  vector<pair<int, pair<int, int>>> res;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (a[i][j] == '*') {
        int x = f(i, j);
        if (x > 0) {
          used[i][j] = 1;
          res.push_back({i, {j, x}});
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (a[i][j] == '*' && used[i][j] == 0) {
        cout << "-1\n";
        return 0;
      }
    }
  }
  cout << (int)res.size() << "\n";
  for (auto x : res)
    cout << x.first << " " << x.second.first << " " << x.second.second << "\n";
}
