#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
struct Dbg {
  template <typename T>
  Dbg& operator,(const T& v) {
    cerr << v << ", ";
    return *this;
  }
} Dbg;
template <typename T>
ostream& operator<<(ostream& _o_, const vector<T>& _v_) {
  if (!_v_.empty()) {
    _o_ << '[';
    copy(_v_.begin(), _v_.end(), ostream_iterator<T>(_o_, ", "));
    _o_ << "\b\b]";
  }
  return _o_;
}
template <class C>
void mini(C& _a, C _b) {
  _a = min(_a, _b);
}
template <class C>
void maxi(C& _a, C _b) {
  _a = max(_a, _b);
}
vector<int> scn();
bool a[1005][1005];
bool vis[1005][1005];
int cnt[4], n, m;
inline pair<bool, int> iscenter(int i, int j) {
  memset(cnt, 0, sizeof(cnt));
  int tmp = i;
  while (tmp >= 0 && a[tmp][j]) {
    cnt[0]++;
    tmp--;
  }
  tmp = i;
  if (cnt[0] == 1) return {0, 0};
  while (tmp < n && a[tmp][j]) {
    cnt[1]++;
    tmp++;
  }
  if (cnt[1] == 1) return {0, 0};
  tmp = j;
  while (tmp >= 0 && a[i][tmp]) {
    cnt[2]++;
    tmp--;
  }
  if (cnt[2] == 1) return {0, 0};
  tmp = j;
  while (tmp < m && a[i][tmp]) {
    cnt[3]++;
    tmp++;
  }
  if (cnt[3] == 1) return {0, 0};
  return make_pair(1, *min_element(cnt, cnt + 4));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      char c;
      cin >> c;
      a[i][j] = (c == '*');
    }
  }
  vector<pair<int, pair<int, int>>> ans;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (a[i][j]) {
        pair<bool, int> resp = iscenter(i, j);
        if (resp.first) {
          ans.push_back(make_pair(resp.second, make_pair(i, j)));
          for (int k = i; k < i + resp.second; k++) {
            vis[k][j] = 1;
          }
          for (int k = i; k > i - resp.second; k--) {
            vis[k][j] = 1;
          }
          for (int k = j; k > j - resp.second; k--) {
            vis[i][k] = 1;
          }
          for (int k = j; k < j + resp.second; k++) {
            vis[i][k] = 1;
          }
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (a[i][j] && !vis[i][j]) {
        cout << -1;
        return 0;
      }
    }
  }
  cout << ans.size() << '\n';
  for (auto x : ans) {
    cout << x.second.first + 1 << ' ' << x.second.second + 1 << ' '
         << x.first - 1 << '\n';
  }
  return 0;
}
vector<int> scn(int n) {
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  return a;
}
