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 int MAX = 1005;
char s[MAX][MAX];
int mm[MAX][MAX];
int rowSum[MAX][MAX], colSum[MAX][MAX];
bool ff[MAX][MAX];
int n, m;
void p1() { printf("YES\n"); }
void p2() { printf("NO\n"); }
bool checkRow(int row, int c1, int c2) {
  return rowSum[row][c2] - (c1 == 0 ? 0 : rowSum[row][c1 - 1]) == c2 - c1 + 1;
}
bool checkCol(int col, int r1, int r2) {
  return colSum[r2][col] - (r1 == 0 ? 0 : colSum[r1 - 1][col]) == r2 - r1 + 1;
}
unordered_set<int> satisRow, satisCol;
inline void pwr(int row, int c1, int c2) {
  for (int j = (c1); j <= (c2); ++j) ff[row][j] = 0;
}
inline void pwc(int col, int r1, int r2) {
  for (int i = (r1); i <= (r2); ++i) ff[i][col] = 0;
}
int total, cnt;
inline void pwrC(int row, int c1, int c2) {
  for (int j = (c1); j <= (c2); ++j) {
    if (ff[row][j] == 0) ff[row][j] = 1, cnt++;
  }
}
inline void pwcC(int col, int r1, int r2) {
  for (int i = (r1); i <= (r2); ++i) {
    if (ff[i][col] == 0) ff[i][col] = 1, cnt++;
  }
}
inline bool checkR(int row, int c1, int c2) {
  for (int j = (c1); j <= (c2); ++j) {
    if (s[row][j] != '#') return 0;
  }
  return 1;
}
inline bool checkC(int col, int r1, int r2) {
  for (int i = (r1); i <= (r2); ++i) {
    if (s[i][col] != '#') return 0;
  }
  return 1;
}
inline bool onlyR(int row) {
  int j = 0, cnt = 0;
  while (j < m) {
    if (s[row][j] != '#')
      j++;
    else {
      cnt++;
      int k = j + 1;
      while (k < m && s[row][k] == '#') k++;
      j = k;
    }
  }
  return cnt == 1;
}
inline bool onlyC(int col) {
  int i = 0, cnt = 0;
  while (i < n) {
    if (s[i][col] == '.')
      i++;
    else {
      cnt++;
      int k = i + 1;
      while (k < n && s[k][col] == '#') k++;
      i = k;
    }
  }
  return cnt == 1;
}
void draw(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) {
  pwr(x1, y1, y2), pwr(x2, y1, y2);
  pwc(y1, x1, x2), pwc(y2, x1, x2);
  pwr(x3, y3, y4), pwr(x4, y3, y4);
  pwc(y3, x3, x4), pwc(y4, x3, x4);
  cnt = 0;
  pwrC(x1, y1, y2), pwrC(x2, y1, y2);
  pwcC(y1, x1, x2), pwcC(y2, x1, x2);
  pwrC(x3, y3, y4), pwrC(x4, y3, y4);
  pwcC(y3, x3, x4), pwcC(y4, x3, x4);
}
struct node {
  int x1, y1, x2, y2;
  node(int a = -1, int b = -1, int c = -1, int d = -1)
      : x1(a), y1(b), x2(c), y2(d) {}
  void print() { printf("%d %d %d %d\n", x1 + 1, y1 + 1, x2 + 1, y2 + 1); }
};
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (0); i <= (n - 1); ++i) scanf("%s", s[i]);
  total = 0;
  for (int i = (0); i <= (n - 1); ++i) {
    for (int j = (0); j <= (m - 1); ++j) {
      if (s[i][j] == '#')
        mm[i][j] = 1, total++;
      else
        mm[i][j] = 0;
    }
  }
  for (int i = (0); i <= (n - 1); ++i) {
    for (int j = (0); j <= (m - 1); ++j) {
      if (j == 0)
        rowSum[i][j] = mm[i][j] == 1;
      else
        rowSum[i][j] = rowSum[i][j - 1] + (mm[i][j] == 1);
    }
  }
  for (int j = (0); j <= (m - 1); ++j) {
    for (int i = (0); i <= (n - 1); ++i) {
      if (i == 0)
        colSum[i][j] = mm[i][j] == 1;
      else
        colSum[i][j] = colSum[i - 1][j] + (mm[i][j] == 1);
    }
  }
  for (int i = (0); i <= (n - 1); ++i) {
    int j = 0;
    bool ok = 0;
    while (j < m && !ok) {
      if (mm[i][j] == 0)
        j++;
      else {
        int k = j + 1;
        while (k < m && mm[i][k] == 1) k++;
        if (k - j >= 3) ok = 1;
        j = k;
      }
    }
    if (ok) satisRow.insert(i);
  }
  for (int j = (0); j <= (m - 1); ++j) {
    int i = 0;
    bool ok = 0;
    while (i < n && !ok) {
      if (mm[i][j] == 0)
        i++;
      else {
        int k = i + 1;
        while (k < n && mm[k][j] == 1) k++;
        if (k - i >= 3) ok = 1;
        i = k;
      }
    }
    if (ok) satisCol.insert(j);
  }
  if (satisRow.size() > 4 && satisCol.size() > 4) {
    p2();
  } else if (satisRow.size() > 4) {
    if (satisCol.size() != 4)
      p2();
    else {
      vector<int> hh;
      for (int c : satisCol) hh.push_back(c);
      sort(hh.begin(), hh.end());
      if (!onlyC(hh[0]) || !onlyC(hh[3]))
        p2();
      else {
        int mi1 = INT_MAX, mx1 = INT_MIN, mi2 = INT_MAX, mx2 = INT_MIN;
        for (int i = (0); i <= (n - 1); ++i) {
          if (s[i][hh[0]] == '#') mi1 = min(mi1, i), mx1 = max(mx1, i);
          if (s[i][hh[3]] == '#') mi2 = min(mi2, i), mx2 = max(mx2, i);
        }
        int x1 = mi1, y1 = hh[0], x2 = mx1, y2 = hh[2], x3 = mi2, y3 = hh[1],
            x4 = mx2, y4 = hh[3];
        draw(x1, y1, x2, y2, x3, y3, x4, y4);
        if (total == cnt) {
          node n1 = node(x1, y1, x2, y2), n2 = node(x3, y3, x4, y4);
          p1();
          n1.print(), n2.print();
        } else
          p2();
      }
    }
  } else if (satisCol.size() > 4) {
    if (satisRow.size() != 4)
      p2();
    else {
      vector<int> hh;
      for (int c : satisRow) hh.push_back(c);
      sort(hh.begin(), hh.end());
      if (!onlyR(hh[0]) || !onlyR(hh[3]))
        p2();
      else {
        int mi1 = INT_MAX, mx1 = INT_MIN, mi2 = INT_MAX, mx2 = INT_MIN;
        for (int j = (0); j <= (m - 1); ++j) {
          if (s[hh[0]][j] == '#') mi1 = min(mi1, j), mx1 = max(mx1, j);
          if (s[hh[3]][j] == '#') mi2 = min(mi2, j), mx2 = max(mx2, j);
        }
        int x1 = hh[0], y1 = mi1, x2 = hh[2], y2 = mx1, x3 = hh[1], y3 = mi2,
            x4 = hh[3], y4 = mx2;
        draw(x1, y1, x2, y2, x3, y3, x4, y4);
        if (total == cnt) {
          node n1 = node(x1, y1, x2, y2), n2 = node(x3, y3, x4, y4);
          p1();
          n1.print(), n2.print();
        } else
          p2();
      }
    }
  } else if (satisRow.size() <= 4 && satisCol.size() <= 4) {
    node n1, n2;
    set<pair<int, int> > sels;
    for (int r : satisRow) {
      for (int c : satisCol) {
        sels.insert({r, c});
      }
    }
    auto check = [](const pair<int, int> &a, const pair<int, int> &b) -> bool {
      bool f = b.first - a.first >= 2 && b.second - a.second >= 2;
      if (!f)
        return 0;
      else {
        int x1 = a.first, y1 = a.second, x2 = b.first, y2 = b.second;
        for (int j = (y1); j <= (y2); ++j)
          if (s[x1][j] != '#' || s[x2][j] != '#') return 0;
        for (int i = (x1); i <= (x2); ++i)
          if (s[i][y1] != '#' || s[i][y2] != '#') return 0;
        return 1;
      }
    };
    bool find = 0;
    for (auto &e1 : sels) {
      for (auto &e2 : sels) {
        for (auto &f1 : sels) {
          for (auto &f2 : sels) {
            if (check(e1, e2) && check(f1, f2)) {
              int x1 = e1.first, y1 = e1.second, x2 = e2.first, y2 = e2.second,
                  x3 = f1.first, y3 = f1.second, x4 = f2.first, y4 = f2.second;
              draw(x1, y1, x2, y2, x3, y3, x4, y4);
              if (cnt == total) {
                find = 1, n1 = node(x1, y1, x2, y2), n2 = node(x3, y3, x4, y4);
                goto exit;
              }
            }
          }
        }
      }
    }
  exit:
    if (!find)
      p2();
    else {
      p1();
      n1.print(), n2.print();
    }
  }
  return 0;
}