Problem: One day Vasya got hold of a sheet of checkered paper n × m squares in size. Our Vasya adores geometrical figures, so he painted two rectangles on the paper. The rectangles' sides are parallel to the coordinates' axes, also the length of each side of each rectangle is no less than 3 squares and the sides are painted by the grid lines. The sides can also be part of the sheet of paper's edge. Then Vasya hatched all squares on the rectangles' frames.

Let's define a rectangle's frame as the set of squares inside the rectangle that share at least one side with its border.

A little later Vasya found a sheet of paper of exactly the same size and couldn't guess whether it is the same sheet of paper or a different one. So, he asked you to check whether the sheet of paper he had found contains two painted frames and nothing besides them.

Please note that the frames painted by Vasya can arbitrarily intersect, overlap or even completely coincide.

The coordinates on the sheet of paper are introduced in such a way that the X axis goes from top to bottom, the x coordinates of the squares' numbers take values from 1 to n and the Y axis goes from the left to the right and the y coordinates of the squares' numbers take values from 1 to m.

Input

The first input line contains two integers n and m (3 ≤ n, m ≤ 1000) — the sizes of the sheet of paper Vasya found. Next n lines, each consisting of m symbols "." (dot) and "#" (number sign), describe the found sheet of paper. The symbol "#" represents a hatched square and the symbol "." represents a non-hatched square.

Output

In the first line print the single word "YES" or "NO", meaning whether it is true that the found sheet of paper has two frames painted on it. If the answer is positive, then print in the second line 4 integers: the coordinates of the upper left and lower right corners of the first frame. In the third line print 4 integers: the coordinates of the upper left and the lower right corners of the second frame. If there are multiple answers, print any of them.

Examples

Input

4 5
#####
#.#.#
###.#
#####


Output

YES
1 1 3 3
1 1 4 5


Input

5 6
...###
...###
#####.
#...#.
#####.


Output

NO

Note

In the first sample there are two frames on the picture. The first one is:
    
    
    ###..  
    #.#..  
    ###..  
    .....  
    

The second one is:
    
    
    #####  
    #...#  
    #...#  
    #####  
    

In the second sample the painted figures are not frames. Note that the height and width of valid frames is no less than 3.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const string file_name = "testcase.D165";
const int INF = 1 << 30;
int n, m;
int f[1005][1005];
char fig[1005][1005], draw[2][1005][1005];
class Frame {
 public:
  void init_val(void) {
    memset(f, 0, sizeof(f));
    memset(fig, 0, sizeof(fig));
    memset(draw, 0, sizeof(draw));
  }
  void init_draw(void) {
    for (int k = 0; k < (2); k++)
      for (int i = 0; i < (n); i++)
        for (int j = 0; j < (m); j++) draw[k][i][j] = '.';
  }
  void drawing(pair<pair<int, int>, pair<int, int> > r, int rayer, char C) {
    int sy = r.first.first;
    int sx = r.first.second;
    int ey = r.second.first;
    int ex = r.second.second;
    for (int i = sy; i <= ey; i++)
      draw[rayer][i][sx] = C, draw[rayer][i][ex] = C;
    for (int j = sx; j <= ex; j++)
      draw[rayer][sy][j] = C, draw[rayer][ey][j] = C;
  }
  int is_fill(pair<int, int> s, pair<int, int> e) {
    for (int first = s.first; first <= e.first; first++) {
      for (int second = s.second; second <= e.second; second++) {
        if (fig[first][second] != '#') return 0;
      }
    }
    int res = min(e.first - s.first + 1, e.second - s.second + 1);
    return res;
  }
  bool is_same(void) {
    for (int i = 0; i < (n); i++)
      for (int j = 0; j < (m); j++) {
        if (fig[i][j] == '.' && (draw[0][i][j] == '.' && draw[1][i][j] == '.'))
          continue;
        if (fig[i][j] == '#' && (draw[0][i][j] == '#' || draw[1][i][j] == '#'))
          continue;
        return false;
      }
    return true;
  }
  bool is_match(pair<pair<int, int>, pair<int, int> > r0,
                pair<pair<int, int>, pair<int, int> > r1) {
    init_draw();
    drawing(r0, 0, '#');
    drawing(r1, 1, '#');
    bool res = is_same();
    drawing(r0, 0, '.');
    drawing(r1, 1, '.');
    return res;
  }
  void print_out(vector<pair<pair<int, int>, pair<int, int> > > rect, int i) {
    int sy = rect[i].first.first;
    int sx = rect[i].first.second;
    int ey = rect[i].second.first;
    int ex = rect[i].second.second;
    cout << sy + 1 << ' ' << sx + 1 << ' ' << ey + 1 << ' ' << ex + 1 << endl;
  }
  void disp_draw(void) {
    for (int i = 0; i < (n); i++) {
      for (int j = 0; j < (m); j++) {
        cout << (draw[0][i][j] == '#' || draw[1][i][j] == '#' ? '#' : '.');
      }
      cout << endl;
    }
  }
  bool is_rect(pair<int, int> s, pair<int, int> e) {
    for (int first = s.first; first < e.first; first++) {
      if (!(f[first][s.second] & (0x1 | 0x4))) return false;
      if (!(f[first][e.second] & (0x1 | 0x4))) return false;
    }
    if (!(f[e.first][s.second] & (0x1 | 0x2))) return false;
    for (int second = s.second; second < e.second; second++) {
      if (!(f[s.first][second] & (0x8 | 0x2))) return false;
      if (!(f[e.first][second] & (0x8 | 0x2))) return false;
    }
    if (!(f[s.first][e.second] & (0x4 | 0x8))) return false;
    if (min(e.second - s.second, e.first - s.first) < 2) return false;
    return true;
  }
};
int main() {
  Frame frame;
  const int d[][2] = {{-1, 0}, {-1, 1}, {0, 1},  {1, 1},
                      {1, 0},  {1, -1}, {0, -1}, {-1, -1}};
  frame.init_val();
  cin >> n >> m;
  for (int i = 0; i < (n); i++) {
    string s = "";
    cin >> s;
    for (int j = 0; j < (m); j++) {
      fig[i][j] = s[j];
    }
  }
  int cnt = 0;
  for (int i = 0; i < (n); i++) {
    for (int j = 0; j < (m); j++) {
      if (fig[i][j] == '#') {
        cnt++;
        for (int k = 0; k < 8; k += 2) {
          int ni = i + d[k][0];
          int nj = j + d[k][1];
          if (ni < 0 || nj < 0 || ni >= n || nj >= m) continue;
          if (fig[ni][nj] == '#') {
            f[i][j] |= (1 << (k / 2));
          }
        }
      }
    }
  }
  if (min(m, n) >= 4) {
    int outer = 2 * max(m, n) + 2 * (min(m, n) - 2);
    int inner = 2 * (max(m, n) - 2) + 2 * (min(m, n) - 4);
    if (cnt > outer + inner) {
      cout << "NO" << endl;
      return 0;
    }
  } else if (min(m, n) != 3 || max(m, n) != 4) {
    int outer = 2 * max(m, n) + 2 * (min(m, n) - 2);
    if (cnt > outer) {
      cout << "NO" << endl;
      return 0;
    }
  }
  pair<int, int> LUcorner = pair<int, int>(-1, -1),
                 RDcorner = pair<int, int>(-1, -1);
  for (int i = 0; i < (n); i++) {
    for (int j = 0; j < (m); j++) {
      if ((f[i][j] & (0x2 | 0x4)) == (0x2 | 0x4)) {
        LUcorner = pair<int, int>(i, j);
        break;
      }
    }
    if (LUcorner.first != -1) break;
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int j = m - 1; j >= 0; j--) {
      if ((f[i][j] & (0x8 | 0x1)) == (0x8 | 0x1)) {
        RDcorner = pair<int, int>(i, j);
        break;
      }
    }
    if (RDcorner.first != -1) break;
  }
  int fill = 0;
  fill = frame.is_fill(LUcorner, RDcorner);
  if (fill > 4) {
    cout << "NO" << endl;
    return 0;
  } else if (fill == 4) {
    vector<pair<pair<int, int>, pair<int, int> > > r(2);
    if (RDcorner.first - LUcorner.first + 1 == 4) {
      r[0] = pair<pair<int, int>, pair<int, int> >(
          pair<int, int>(LUcorner.first, LUcorner.second),
          pair<int, int>(RDcorner.first - 1, RDcorner.second));
      r[1] = pair<pair<int, int>, pair<int, int> >(
          pair<int, int>(LUcorner.first + 1, LUcorner.second),
          pair<int, int>(RDcorner.first, RDcorner.second));
    } else {
      r[0] = pair<pair<int, int>, pair<int, int> >(
          pair<int, int>(LUcorner.first, LUcorner.second),
          pair<int, int>(RDcorner.first, RDcorner.second - 1));
      r[1] = pair<pair<int, int>, pair<int, int> >(
          pair<int, int>(LUcorner.first, LUcorner.second + 1),
          pair<int, int>(RDcorner.first, RDcorner.second));
    }
    if (frame.is_match(r[0], r[1])) {
      cout << "YES" << endl;
      frame.print_out(r, 0);
      frame.print_out(r, 1);
      return 0;
    } else {
      cout << "NO" << endl;
      return 0;
    }
  }
  vector<pair<int, int> > lu, rd;
  lu.clear(), rd.clear();
  lu.push_back(LUcorner);
  rd.push_back(RDcorner);
  int mind = INF;
  pair<int, int> curr = pair<int, int>(-1, -1);
  for (int i = lu[0].first; i < n; i++) {
    for (int j = (i == lu[0].first ? lu[0].second + 1 : 0); j < m; j++) {
      if ((f[i][j] & (0x4 | 0x2)) == (0x4 | 0x2)) {
        if (mind > abs(lu[0].first - i) + abs(lu[0].second - j)) {
          mind = abs(lu[0].first - i) + abs(lu[0].second - j);
          curr = pair<int, int>(i, j);
        }
      }
      if (f[i][j] == (0x4 | 0x2)) {
        lu.push_back(pair<int, int>(i, j));
      }
    }
  }
  if (curr.first != -1) {
    lu.push_back(curr);
    for (int k = 0; k < (8); k++) {
      int py = curr.first + d[k][0], px = curr.second + d[k][1];
      if (py >= 0 && px >= 0 && py < n && px < m &&
          ((f[py][px] & (0x4 | 0x2)) == (0x4 | 0x2)))
        lu.push_back(pair<int, int>(py, px));
    }
  }
  mind = INF;
  curr = pair<int, int>(-1, -1);
  for (int i = rd[0].first; i >= 0; i--) {
    for (int j = (i == rd[0].first ? rd[0].second - 1 : m - 1); j >= 0; j--) {
      if ((f[i][j] & (0x1 | 0x8)) == (0x1 | 0x8)) {
        if (mind > abs(rd[0].first - i) + abs(rd[0].second - j)) {
          mind = abs(rd[0].first - i) + abs(rd[0].second - j);
          curr = pair<int, int>(i, j);
        }
      }
      if (f[i][j] == (0x1 | 0x8)) {
        rd.push_back(pair<int, int>(i, j));
      }
    }
  }
  if (curr.first != -1) {
    rd.push_back(curr);
    for (int k = 0; k < (8); k++) {
      int py = curr.first + d[k][0], px = curr.second + d[k][1];
      if (py >= 0 && px >= 0 && py < n && px < m &&
          ((f[py][px] & (0x1 | 0x8)) == (0x1 | 0x8)))
        rd.push_back(pair<int, int>(py, px));
    }
  }
  vector<pair<pair<int, int>, pair<int, int> > > rect;
  for (int i = 0; i < (lu.size()); i++)
    for (int j = 0; j < (rd.size()); j++) {
      if (frame.is_rect(lu[i], rd[j])) {
        rect.push_back(pair<pair<int, int>, pair<int, int> >(lu[i], rd[j]));
      }
    }
  for (int i = 0; i < (rect.size()); i++) {
    for (int j = 0; j < (rect.size()); j++) {
      if (frame.is_match(rect[i], rect[j])) {
        cout << "YES" << endl;
        frame.print_out(rect, i);
        frame.print_out(rect, j);
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}