#include <bits/stdc++.h>
using namespace std;
const int HMAX = 20, NB_DEPL = 4;
int h, w, distances[HMAX][HMAX],
    depl[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
char s[HMAX][HMAX];
bool vu[HMAX][HMAX];
queue<pair<int, int> > enAttente;
pair<int, int> findFarthest(int row, int col) {
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      vu[i][j] = false;
    }
  }
  int row_cur, col_cur, row_next, col_next;
  distances[row][col] = 0;
  pair<int, int> depart = make_pair(row, col), current;
  enAttente.push(depart);
  while (!enAttente.empty()) {
    current = enAttente.front();
    enAttente.pop();
    row_cur = current.first;
    col_cur = current.second;
    vu[row_cur][col_cur] = true;
    for (int i = 0; i < NB_DEPL; i++) {
      row_next = row_cur + depl[i][0];
      col_next = col_cur + depl[i][1];
      if (h > row_next && row_next >= 0 && w > col_next && col_next >= 0 &&
          s[row_next][col_next] == '.' && !vu[row_next][col_next]) {
        vu[row_next][col_next] = true;
        distances[row_next][col_next] = distances[row_cur][col_cur] + 1;
        enAttente.push(make_pair(row_next, col_next));
      }
    }
  }
  return make_pair(row_cur, col_cur);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> h >> w;
  int colBegin, rowBegin;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> s[i][j];
      if (s[i][j] == '.') {
        colBegin = j;
        rowBegin = i;
      }
    }
  }
  pair<int, int> p = findFarthest(rowBegin, colBegin);
  int rowInt = p.first, colInt = p.second;
  p = findFarthest(rowInt, colInt);
  cout << colBegin << ' ' << rowBegin << '\n';
  cout << rowInt << ' ' << colInt << '\n';
  cout << p.first << ' ' << p.second << '\n';
  cout << distances[p.first][p.second] << '\n';
  return 0;
}
