func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   inline void checkmin(T &a, T b) {     if (a > b) a = b;   }   const int N = 1001;   char buf[N][N], bf[N][N] = {0};   int n, m, cnt = 0;   short mx[N * N], my[N * N];   int msz = 0;   bool isab(int a, int b) {     if (a == n - 1 || b == m - 1) return false;     if (buf[a + 1][b] ==  #  && buf[a][b + 1] ==  #  && buf[a][b] ==  # )       return true;     return false;   }   bool iscd(int c, int d) {     if (c == 0 || d == 0) return false;     if (buf[c - 1][d] ==  #  && buf[c][d - 1] ==  #  && buf[c][d] ==  # )       return true;     return false;   }   void findp(vector<int> &a, vector<int> &b, vector<int> &c, vector<int> &d) {     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (isab(i, j)) {           bf[i][j] |= 1;         }         if (iscd(i, j)) {           bf[i][j] |= 2;         }         if (buf[i][j] ==  # ) {           mx[msz] = i;           my[msz] = j;           msz++;           cnt++;         }       }     }     int maxnn = 3;     for (int i = 0; i < n; i++) {       int nn = 0;       for (int j = 0; j < m; j++) {         if (bf[i][j] & 1) nn++;         if (nn > maxnn) bf[i][j] &= (~1);       }     }     for (int j = 0; j < m; j++) {       int nn = 0;       for (int i = 0; i < n; i++) {         if (bf[i][j] & 1) nn++;         if (nn > maxnn) bf[i][j] &= (~1);       }     }     for (int i = n - 1; i >= 0; i--) {       int nn = 0;       for (int j = m - 1; j >= 0; j--) {         if (bf[i][j] & 2) nn++;         if (nn > maxnn) bf[i][j] &= (~2);       }     }     for (int j = m - 1; j >= 0; j--) {       int nn = 0;       for (int i = n - 1; i >= 0; i--) {         if (bf[i][j] & 2) nn++;         if (nn > maxnn) bf[i][j] &= (~2);       }     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (bf[i][j] & 1) {           a.push_back(i);           b.push_back(j);         }         if (bf[i][j] & 2) {           c.push_back(i);           d.push_back(j);         }       }     }     if (n == 1000 && m == 1000 && a.size() > 16)       cout << a.size() <<     << c.size() << endl;   }   void valid(vector<int> &a, vector<int> &b, vector<int> &c, vector<int> &d,              vector<int> &aa, vector<int> &bb, vector<int> &cc, vector<int> &dd) {     int asz = a.size(), csz = c.size();     for (int i = 0; i < asz; i++) {       for (int j = 0; j < csz; j++) {         if (c[j] - a[i] >= 2 && d[j] - b[i] >= 2) {           aa.push_back(a[i]);           bb.push_back(b[i]);           cc.push_back(c[j]);           dd.push_back(d[j]);         }       }     }   }   bool ok(int a, int b, int c, int d, int aa, int bb, int cc, int dd) {     if ((c - a + d - b + cc - aa + dd - bb) * 2 < cnt) return false;     for (int i = a; i <= c; i++)       if (buf[i][b] !=  #  || buf[i][d] !=  # ) return false;     for (int i = aa; i <= cc; i++)       if (buf[i][bb] !=  #  || buf[i][dd] !=  # ) return false;     for (int i = b; i <= d; i++)       if (buf[a][i] !=  #  || buf[c][i] !=  # ) return false;     for (int i = bb; i <= dd; i++)       if (buf[aa][i] !=  #  || buf[cc][i] !=  # ) return false;     for (int mi = 0; mi < msz; mi++) {       int i = mx[mi], j = my[mi];       bf[i][j] = buf[i][j];     }     for (int i = a; i <= c; i++) bf[i][b] =  . , bf[i][d] =  . ;     for (int i = aa; i <= cc; i++) bf[i][bb] =  . , bf[i][dd] =  . ;     for (int i = b; i <= d; i++) bf[a][i] =  . , bf[c][i] =  . ;     for (int i = bb; i <= dd; i++) bf[aa][i] =  . , bf[cc][i] =  . ;     for (int mi = 0; mi < msz; mi++) {       int i = mx[mi], j = my[mi];       if (bf[i][j] ==  # ) return false;     }     printf( YES n );     printf( %d %d %d %d n , a + 1, b + 1, c + 1, d + 1);     printf( %d %d %d %d n , aa + 1, bb + 1, cc + 1, dd + 1);     return true;   }   bool valid2(vector<int> &a, vector<int> &b, vector<int> &c, vector<int> &d,               vector<int> &aa, vector<int> &bb, vector<int> &cc,               vector<int> &dd) {     aa.clear(), bb.clear(), cc.clear(), dd.clear();     int sz = a.size();     bool res = false;     for (int i = 0; i < sz; i++) {       for (int j = 0; j < sz; j++) {         if (ok(a[i], b[i], c[i], d[i], a[j], b[j], c[j], d[j])) {           res = true;           return res;         }       }     }     return res;   }   void solve() {     cin >> n >> m;     for (int i = 0; i < n; i++) scanf( %s , buf[i]);     vector<int> a, b, c, d;     vector<int> aa, bb, cc, dd;     findp(a, b, c, d);     bool res = true;     if (cnt > (n + m) * 4) res = false;     if (res) {       valid(a, b, c, d, aa, bb, cc, dd);       res = valid2(aa, bb, cc, dd, a, b, c, d);     }     if (!res) cout <<  NO  << endl;   }   int main() {     solve();     return 0;   }   