#include <bits/stdc++.h>
using namespace std;
int dxg[4] = {1, 0, -1, 0};
int dyg[4] = {0, 1, 0, -1};
int maxH = 500;
int maxW = 500;
int main(int argc, char *argv[]) {
  int dx, dy;
  cin >> dx >> dy;
  vector<vector<int> > Cvec(dx, vector<int>(dy));
  vector<vector<bool> > reached(dx, vector<bool>(dy));
  char status;
  for (int i = 0; i <= dx - 1; i++) {
    for (int j = 0; j <= dy - 1; j++) {
      cin >> status;
      Cvec[i][j] = status;
      reached[i][j] = false;
    }
  }
  vector<vector<int> > Cvectmp(dx, vector<int>(dy));
  vector<vector<bool> > reachedtmp(dx, vector<bool>(dy));
  for (int i = 0; i <= dx - 1; i++) {
    for (int j = 0; j <= dy - 1; j++) {
      Cvectmp = Cvec;
      reachedtmp = reached;
      if (Cvec[i][j] != '#')
        Cvectmp[i][j] = 's';
      else
        continue;
      for (int k = 0; k <= dx - 1; k++) {
        for (int l = 0; l <= dy - 1; l++) {
          if (Cvec[k][l] != '#') Cvectmp[k][l] = 'g';
          queue<pair<int, int> > que;
          que.push(pair<int, int>(i, j));
          int count = 0;
          while (!que.empty()) {
            pair<int, int> cur = que.front();
            que.pop();
            for (int dir = 0; dir < 4; ++dir) {
              pair<int, int> nex =
                  pair<int, int>(cur.first + dxg[dir], cur.second + dyg[dir]);
              if (nex.first < 0 || nex.first >= dx || nex.second < 0 ||
                  nex.second >= dy)
                continue;
              if (Cvectmp[nex.first][nex.second] == '#') continue;
              if (reachedtmp[nex.first][nex.second]) continue;
              reachedtmp[nex.first][nex.second] =
                  reachedtmp[cur.first][cur.second] + 1;
              que.push(nex);
            }
            count++;
            if (Cvectmp[cur.first][cur.second] == 'g') break;
          }
          cout << count << " " << i << " " << j << " " << k << " " << l << endl;
        }
      }
    }
  }
}
