#include <bits/stdc++.h>
using namespace std;
struct Point {
  int x, y;
  void write() { cout << y << " " << x << " "; }
};
struct Four {
  int a, b, c, d;
};
struct FourLess {
  bool operator()(const Four &f1, const Four &f2) const {
    if (f1.a == f2.a) {
      if (f1.b == f2.b) {
        if (f1.c == f2.c) {
          return f1.d < f2.d;
        }
        return f1.c < f2.c;
      }
      return f1.b < f2.b;
    }
    return f1.a < f2.a;
  }
};
struct Frame {
  Point p1, p2;
  void write() {
    p1.write();
    p2.write();
    cout << endl;
  }
};
int n, m;
char f[1005][1005];
bool fx[1005], fy[1005];
int used[1005][1005];
vector<int> x, y;
vector<Four> xperm, yperm;
Frame f1, f2;
int cnt;
bool check_four(Four &f) { return (f.b >= f.a + 2) && (f.d >= f.c + 2); }
void vsf(vector<int> &v, set<Four, FourLess> &s, int ind1, int ind2, int ind3,
         int ind4) {
  Four f;
  f.a = v[ind1];
  f.b = v[ind2];
  f.c = v[ind3];
  f.d = v[ind4];
  if (check_four(f)) s.insert(f);
}
void init_perm(vector<int> coord, vector<Four> &perm) {
  set<Four, FourLess> uniq;
  Four f;
  while (coord.size() < 4) coord.push_back(coord[0]);
  sort(coord.begin(), coord.end());
  do {
    vsf(coord, uniq, 0, 1, 2, 3);
    vsf(coord, uniq, 0, 1, 2, 0);
    vsf(coord, uniq, 0, 1, 1, 2);
    vsf(coord, uniq, 0, 1, 0, 2);
    vsf(coord, uniq, 0, 1, 2, 1);
    vsf(coord, uniq, 0, 1, 0, 1);
  } while (next_permutation(coord.begin(), coord.end()));
  for (set<Four, FourLess>::iterator it = uniq.begin(); it != uniq.end();
       it++) {
    perm.push_back(*it);
  }
}
void check_square(int x, int y, char c, int inv) {
  int cnt = 0;
  int px, py;
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      if (f[y + i][x + j] == c) {
        px = j;
        py = i;
        cnt++;
      }
    }
  }
  if (cnt == 1) {
    fx[x + (px ^ inv)] = true;
    fy[y + (py ^ inv)] = true;
  }
}
void look(bool *flags, vector<int> &v, int cur, int dt) {
  if (!flags[cur + dt]) {
    flags[cur + dt] = true;
    v.push_back(cur + dt);
  }
}
void process(bool *flags, vector<int> &v) {
  int n = v.size();
  look(flags, v, v[0], 1);
  for (int i = 1; i < n - 1; i++) {
    look(flags, v, i, -1);
    look(flags, v, i, 1);
  }
  look(flags, v, v[n - 1], -1);
}
int count_yline(int y, int x1, int x2, int color) {
  int res = 0;
  for (int i = x1; i <= x2; i++) {
    if (f[y][i] != '#') return 1000000;
    if (used[y][i] != color) {
      res++;
      used[y][i] = color;
    }
  }
  return res;
}
int count_xline(int x, int y1, int y2, int color) {
  int res = 0;
  for (int i = y1; i <= y2; i++) {
    if (f[i][x] != '#') return 1000000;
    if (used[i][x] != color) {
      res++;
      used[i][x] = color;
    }
  }
  return res;
}
bool check_frames() {
  static int color = 1;
  int ccnt = 0;
  color++;
  ccnt += count_yline(f1.p1.y, f1.p1.x, f1.p2.x, color);
  ccnt += count_yline(f1.p2.y, f1.p1.x, f1.p2.x, color);
  ccnt += count_yline(f2.p1.y, f2.p1.x, f2.p2.x, color);
  ccnt += count_yline(f2.p2.y, f2.p1.x, f2.p2.x, color);
  ccnt += count_xline(f1.p1.x, f1.p1.y, f1.p2.y, color);
  ccnt += count_xline(f1.p2.x, f1.p1.y, f1.p2.y, color);
  ccnt += count_xline(f2.p1.x, f2.p1.y, f2.p2.y, color);
  ccnt += count_xline(f2.p2.x, f2.p1.y, f2.p2.y, color);
  return ccnt == cnt;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    scanf("%s", f[i] + 1);
  }
  for (int i = 0; i < max(n, m) + 2; i++) {
    f[i][0] = '.';
    f[i][m + 1] = '.';
    f[0][i] = '.';
    f[n + 1][i] = '.';
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      check_square(j, i, '#', 0);
      check_square(j, i, '.', 1);
    }
  }
  for (int i = 1; i <= m; i++) {
    if (fx[i]) x.push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    if (fy[i]) y.push_back(i);
  }
  if (x.size() > 4) {
    cout << "NO";
    return 0;
  }
  if (y.size() > 4) {
    cout << "NO";
    return 0;
  }
  if (x.size() < 2) {
    cout << "NO";
    return 0;
  }
  if (y.size() < 2) {
    cout << "NO";
    return 0;
  }
  if (x.size() < 4) process(fx, x);
  if (y.size() < 4) process(fy, y);
  init_perm(x, xperm);
  init_perm(y, yperm);
  for (int i = 0; i < n + 2; i++) {
    for (int j = 0; j < m + 2; j++) {
      if (f[i][j] == '#') cnt++;
    }
  }
  for (int i = 0; i < xperm.size(); i++) {
    f1.p1.x = xperm[i].a;
    f1.p2.x = xperm[i].b;
    f2.p1.x = xperm[i].c;
    f2.p2.x = xperm[i].d;
    for (int j = 0; j < yperm.size(); j++) {
      f1.p1.y = yperm[j].a;
      f1.p2.y = yperm[j].b;
      f2.p1.y = yperm[j].c;
      f2.p2.y = yperm[j].d;
      if (check_frames()) {
        cout << "YES" << endl;
        f1.write();
        f2.write();
        return 0;
      }
    }
  }
  cout << "NO";
  return 0;
}
