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;
int main() {
  int n, m;
  cin >> n;
  cin >> m;
  string *map = new string[n + 2];
  map[0] = string(m + 2, '.');
  map[n + 1] = string(m + 2, '.');
  string ms;
  for (int i = 0; i < n; i++) {
    cin >> ms;
    map[i + 1] = '.' + ms + '.';
  }
  vector<pair<int, int> > ps;
  int v, h;
  int sum;
  for (int i = 0; i < n + 1; i++)
    for (int j = 0; j < m + 1; j++) {
      if ((map[i][j] == '#')) {
        if ((map[i + 1][j] == '#') && (map[i - 1][j] == '#') &&
            (map[i][j + 1] == '.') && (map[i][j - 1] == '.'))
          continue;
        if ((map[i + 1][j] == '.') && (map[i - 1][j] == '.') &&
            (map[i][j + 1] == '#') && (map[i][j - 1] == '#'))
          continue;
        pair<int, int> p = make_pair(i, j);
        v = ((p.first > 2)
                 ? (((((map[p.first - 1][p.second] == '#') ? 1 : 0) +
                      ((map[p.first - 2][p.second] == '#') ? 1 : 0)) == 2)
                        ? 1
                        : 0)
                 : 0) +
            ((p.first < n - 1)
                 ? (((((map[p.first + 1][p.second] == '#') ? 1 : 0) +
                      ((map[p.first + 2][p.second] == '#') ? 1 : 0)) == 2)
                        ? 1
                        : 0)
                 : 0);
        h = ((p.second > 2)
                 ? (((((map[p.first][p.second - 1] == '#') ? 1 : 0) +
                      ((map[p.first][p.second - 2] == '#') ? 1 : 0)) == 2)
                        ? 1
                        : 0)
                 : 0) +
            ((p.second < m - 1)
                 ? (((((map[p.first][p.second + 1] == '#') ? 1 : 0) +
                      ((map[p.first][p.second + 2] == '#') ? 1 : 0)) == 2)
                        ? 1
                        : 0)
                 : 0);
        if (v == 0 || h == 0) continue;
        sum = 0;
        for (int i1 = -1; i1 < 2; i1++)
          for (int j1 = -1; j1 < 2; j1++)
            sum += ((map[i + i1][j + j1] == '#') ? 1 : 0);
        if (sum >= 6 && v + h > 2) continue;
        ps.push_back(make_pair(i, j));
      }
    }
  int a[8];
  int all_len;
  bool is_cor;
  for (int a1 = 0; a1 < ps.size(); a1++) {
    for (int a2 = 0; a2 < ps.size(); a2++) {
      if (!((ps[a1].first == ps[a2].first) &&
            (ps[a1].second < ps[a2].second - 1)))
        continue;
      for (int a3 = 0; a3 < ps.size(); a3++) {
        if (!((ps[a2].first < ps[a3].first - 1) &&
              (ps[a2].second == ps[a3].second)))
          continue;
        for (int a4 = 0; a4 < ps.size(); a4++) {
          if (!((ps[a3].first == ps[a4].first) &&
                (ps[a3].second - 1 > ps[a4].second)))
            continue;
          if (!((ps[a4].first - 1 > ps[a1].first) &&
                (ps[a4].second == ps[a1].second)))
            continue;
          for (int b1 = 0; b1 < ps.size(); b1++) {
            for (int b2 = 0; b2 < ps.size(); b2++) {
              if (!((ps[b1].first == ps[b2].first) &&
                    (ps[b1].second < ps[b2].second - 1)))
                continue;
              for (int b3 = 0; b3 < ps.size(); b3++) {
                if (!((ps[b2].first < ps[b3].first - 1) &&
                      (ps[b2].second == ps[b3].second)))
                  continue;
                for (int b4 = 0; b4 < ps.size(); b4++) {
                  if (!((ps[b3].first == ps[b4].first) &&
                        (ps[b3].second - 1 > ps[b4].second)))
                    continue;
                  if (!((ps[b4].first - 1 > ps[b1].first) &&
                        (ps[b4].second == ps[b1].second)))
                    continue;
                  all_len = (((ps[a1].first - ps[a2].first >= 0)
                                  ? ps[a1].first - ps[a2].first
                                  : -ps[a1].first - ps[a2].first) +
                             1) *
                                (((ps[a1].second - ps[a2].second >= 0)
                                      ? ps[a1].second - ps[a2].second
                                      : -ps[a1].second - ps[a2].second) +
                                 1) +
                            (((ps[a2].first - ps[a3].first >= 0)
                                  ? ps[a2].first - ps[a3].first
                                  : -ps[a2].first - ps[a3].first) +
                             1) *
                                (((ps[a2].second - ps[a3].second >= 0)
                                      ? ps[a2].second - ps[a3].second
                                      : -ps[a2].second - ps[a3].second) +
                                 1) +
                            (((ps[a4].first - ps[a3].first >= 0)
                                  ? ps[a4].first - ps[a3].first
                                  : -ps[a4].first - ps[a3].first) +
                             1) *
                                (((ps[a4].second - ps[a3].second >= 0)
                                      ? ps[a4].second - ps[a3].second
                                      : -ps[a4].second - ps[a3].second) +
                                 1) +
                            (((ps[a1].first - ps[a4].first >= 0)
                                  ? ps[a1].first - ps[a4].first
                                  : -ps[a1].first - ps[a4].first) +
                             1) *
                                (((ps[a1].second - ps[a4].second >= 0)
                                      ? ps[a1].second - ps[a4].second
                                      : -ps[a1].second - ps[a4].second) +
                                 1);
                  all_len += (((ps[b1].first - ps[b2].first >= 0)
                                   ? ps[b1].first - ps[b2].first
                                   : -ps[b1].first - ps[b2].first) +
                              1) *
                                 (((ps[b1].second - ps[b2].second >= 0)
                                       ? ps[b1].second - ps[b2].second
                                       : -ps[b1].second - ps[b2].second) +
                                  1) +
                             (((ps[b2].first - ps[b3].first >= 0)
                                   ? ps[b2].first - ps[b3].first
                                   : -ps[b2].first - ps[b3].first) +
                              1) *
                                 (((ps[b2].second - ps[b3].second >= 0)
                                       ? ps[b2].second - ps[b3].second
                                       : -ps[b2].second - ps[b3].second) +
                                  1) +
                             (((ps[b4].first - ps[b3].first >= 0)
                                   ? ps[b4].first - ps[b3].first
                                   : -ps[b4].first - ps[b3].first) +
                              1) *
                                 (((ps[b4].second - ps[b3].second >= 0)
                                       ? ps[b4].second - ps[b3].second
                                       : -ps[b4].second - ps[b3].second) +
                                  1) +
                             (((ps[b1].first - ps[b4].first >= 0)
                                   ? ps[b1].first - ps[b4].first
                                   : -ps[b1].first - ps[b4].first) +
                              1) *
                                 (((ps[b1].second - ps[b4].second >= 0)
                                       ? ps[b1].second - ps[b4].second
                                       : -ps[b1].second - ps[b4].second) +
                                  1);
                  if (all_len < ps.size()) continue;
                  string *tmap = new string[n + 2];
                  for (int i = 0; i < n + 2; i++) tmap[i] = map[i];
                  is_cor = true;
                  for (int mx = ps[a1].first; mx < ps[a2].first + 1; mx++)
                    for (int my = ps[a1].second; my < ps[a2].second + 1; my++)
                      if (map[mx][my] != '#')
                        is_cor = false;
                      else
                        tmap[mx][my] = '.';
                  for (int mx = ps[a2].first; mx < ps[a3].first + 1; mx++)
                    for (int my = ps[a2].second; my < ps[a3].second + 1; my++)
                      if (map[mx][my] != '#')
                        is_cor = false;
                      else
                        tmap[mx][my] = '.';
                  for (int mx = ps[a4].first; mx < ps[a3].first + 1; mx++)
                    for (int my = ps[a4].second; my < ps[a3].second + 1; my++)
                      if (map[mx][my] != '#')
                        is_cor = false;
                      else
                        tmap[mx][my] = '.';
                  for (int mx = ps[a1].first; mx < ps[a4].first + 1; mx++)
                    for (int my = ps[a1].second; my < ps[a4].second + 1; my++)
                      if (map[mx][my] != '#')
                        is_cor = false;
                      else
                        tmap[mx][my] = '.';
                  for (int mx = ps[b1].first; mx < ps[b2].first + 1; mx++)
                    for (int my = ps[b1].second; my < ps[b2].second + 1; my++)
                      if (map[mx][my] != '#')
                        is_cor = false;
                      else
                        tmap[mx][my] = '.';
                  for (int mx = ps[b2].first; mx < ps[b3].first + 1; mx++)
                    for (int my = ps[b2].second; my < ps[b3].second + 1; my++)
                      if (map[mx][my] != '#')
                        is_cor = false;
                      else
                        tmap[mx][my] = '.';
                  for (int mx = ps[b4].first; mx < ps[b3].first + 1; mx++)
                    for (int my = ps[b4].second; my < ps[b3].second + 1; my++)
                      if (map[mx][my] != '#')
                        is_cor = false;
                      else
                        tmap[mx][my] = '.';
                  for (int mx = ps[b1].first; mx < ps[b4].first + 1; mx++)
                    for (int my = ps[b1].second; my < ps[b4].second + 1; my++)
                      if (map[mx][my] != '#')
                        is_cor = false;
                      else
                        tmap[mx][my] = '.';
                  for (int i = 0; i < n + 2; i++)
                    for (int j = 0; j < m + 2; j++)
                      if (tmap[i][j] == '#') is_cor = false;
                  if (is_cor) {
                    cout << "YES" << endl;
                    cout << ps[a1].first << " " << ps[a1].second << " "
                         << ps[a3].first << " " << ps[a3].second << endl;
                    cout << ps[b1].first << " " << ps[b1].second << " "
                         << ps[b3].first << " " << ps[b3].second << endl;
                    return 0;
                  }
                  delete[] tmap;
                }
              }
            }
          }
        }
      }
    }
  }
  cout << "NO" << endl;
}