#include <bits/stdc++.h>   using namespace std;   const double pi = acos(-1.0);   template <typename T, typename U>   inline void amin(T &x, U y) {     if (y < x) x = y;   }   template <typename T, typename U>   inline void amax(T &x, U y) {     if (x < y) x = y;   }   using namespace std;   int main() {     int n, m;     cin >> n >> m;     string grid[n];     for (int i = 0; i < n; ++i) {       cin >> grid[i];     }     int left[n][m], right[n][m], top[n][m], bottom[n][m];     memset(left, (0), sizeof(left));     memset(right, (0), sizeof(right));     memset(top, (0), sizeof(top));     memset(bottom, (0), sizeof(bottom));     for (int i = 1; i < n; ++i) {       for (int j = 1; j < m; ++j) {         if (grid[i][j] !=  * ) continue;         left[i][j] = left[i][j - 1];         top[i][j] = top[i - 1][j];         if (grid[i][j - 1] ==  * ) left[i][j] = left[i][j - 1] + 1;         if (grid[i - 1][j] ==  * ) top[i][j] = top[i - 1][j] + 1;       }     }     for (int i = n - 2; i >= 0; --i) {       for (int j = m - 2; j >= 0; --j) {         if (grid[i][j] !=  * ) continue;         if (grid[i][j + 1] ==  * ) right[i][j] = right[i][j + 1] + 1;         if (grid[i + 1][j] ==  * ) bottom[i][j] = bottom[i + 1][j] + 1;       }     }     bool marked[n][m];     memset(marked, (false), sizeof(marked));     vector<int> row, col, sz;     for (int i = 0; i < n; ++i) {       for (int j = 0; j < m; ++j) {         if (grid[i][j] !=  * ) continue;         int cnt1 = min(left[i][j], right[i][j]);         int cnt2 = min(top[i][j], bottom[i][j]);         int cnt = min(cnt1, cnt2);         if (cnt != 0) {           row.push_back(i + 1);           col.push_back(j + 1);           sz.push_back(cnt);           marked[i][j] = true;           for (int k = 1; k <= cnt; ++k) {             marked[i][j - k] = true;             marked[i][j + k] = true;             marked[i - k][j] = true;             marked[i + k][j] = true;           }         }       }     }     bool pos = true;     for (int l = 0; l < n; ++l) {       for (int j = 0; j < m; ++j) {         if (grid[l][j] ==  *  && !marked[l][j]) {           pos = false;           break;         }       }     }     if (pos) {       cout << row.size() <<   n ;       for (int i = 0; i < row.size(); ++i) {         cout << row[i] <<     << col[i] <<     << sz[i] <<   n ;       }     } else {       cout <<  -1 n ;     }     return 0;   }   