#include <bits/stdc++.h>
using namespace std;
int main() {
  int t = 1;
  vector<vector<int>> neigh = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
  for (int i = 0; i < t; ++i) {
    int m, n;
    cin >> n >> m;
    vector<string> v(n);
    vector<vector<int>> ans(n, vector<int>(m, 0));
    vector<vector<int>> g(n * m);
    for (int j = 0; j < n; ++j) {
      cin >> v[j];
    }
    for (int j = 1; j < n - 1; ++j) {
      for (int k = 1; k < m - 1; ++k) {
        if (v[j][k] == 'X') {
          int c = 0;
          vector<int> cell;
          for (auto &d : neigh) {
            int dx = d[0], dy = d[1];
            if (v[j + dx][k + dy] == '.') {
              ++c;
              cell.push_back((j + dx) * m + k + dy);
            }
          }
          if (c % 2 != 0) {
            goto error;
          } else if (c == 2) {
            g[cell[0]].push_back(cell[1]);
            g[cell[1]].push_back(cell[0]);
          } else if (c == 4) {
            g[cell[0]].push_back(cell[3]);
            g[cell[3]].push_back(cell[0]);
            g[cell[1]].push_back(cell[2]);
            g[cell[2]].push_back(cell[1]);
          }
        }
      }
    }
    for (int j = 0; j < n; ++j) {
      for (int k = 0; k < m; ++k) {
        int id = j * m + k;
        if (v[j][k] == '.' && ans[j][k] == 0) {
          list<int> q;
          q.push_back(id);
          ans[j][k] = 1;
          while (!q.empty()) {
            int p = q.front();
            int x = p / m, y = p % m;
            q.pop_front();
            for (auto next : g[p]) {
              int nx = next / m, ny = next % m;
              if (ans[nx][ny] == 0) {
                ans[nx][ny] = 5 - ans[x][y];
                q.push_back(next);
              }
            }
          }
        }
      }
    }
    printf("YES\n");
    for (int j = 0; j < n; ++j) {
      for (int k = 0; k < m; ++k) {
        if (ans[j][k] == 0) {
          for (auto &d : neigh) {
            int dx = d[0], dy = d[1];
            if (v[j + dx][k + dy] == '.') {
              ans[j][k] += ans[j + dx][k + dy];
            }
          }
        }
        printf("%d ", ans[j][k]);
      }
      printf("\n");
    }
    continue;
  error:
    printf("NO\n");
  }
  return 0;
}

### Prompt

Please provide a cpp coded solution to the problem described below:

Alice has an empty grid with n rows and m columns. Some of the cells are marked, and no marked cells are adjacent to the edge of the grid. (Two squares are adjacent if they share a side.) 

Alice wants to fill each cell with a number such that the following statements are true: 

  * every unmarked cell contains either the number 1 or 4; 
  * every marked cell contains the sum of the numbers in all unmarked cells adjacent to it (if a marked cell is not adjacent to any unmarked cell, this sum is 0); 
  * every marked cell contains a multiple of 5. 

Alice couldn't figure it out, so she asks Bob to help her. Help Bob find any such grid, or state that no such grid exists.

Input

The first line of input contains two integers n and m (1 ≤ n, m ≤ 500) — the number of rows and the number of columns in the grid, respectively.

Then n lines follow, each containing m characters. Each of these characters is either '.' or 'X' — an unmarked and a marked cell, respectively. No marked cells are adjacent to the edge of the grid.

Output

Output "'NO" if no suitable grid exists. Otherwise, output "'YES"'. Then output n lines of m space-separated integers — the integers in the grid.

Examples

Input


5 5
.....
.XXX.
.X.X.
.XXX.
.....


Output


YES
4 1 4 4 1
4 5 5 5 1
4 5 1 5 4
1 5 5 5 4
1 4 4 1 4


Input


5 5
.....
.XXX.
.XXX.
.XXX.
.....


Output


NO


Input


3 2
..
..
..


Output


YES
4 1
4 1
1 4


Input


9 9
.........
.XXXXX.X.
.X...X...
.X.XXXXX.
.X.X.X.X.
.X.XXX.X.
.X.....X.
.XXXXXXX.
.........


Output


YES
4 4 4 1 4 1 4 1 4
1 5 5 5 5 5 4 10 1
4 5 1 4 1 5 4 4 4
4 5 1 5 5 0 5 5 1
4 5 1 5 4 5 1 5 4
4 5 1 5 5 5 4 5 1
1 5 4 4 1 1 4 5 1
4 5 5 5 5 5 5 5 4
1 1 1 1 4 4 1 1 4

Note

It can be shown that no such grid exists for the second test.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
  int t = 1;
  vector<vector<int>> neigh = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
  for (int i = 0; i < t; ++i) {
    int m, n;
    cin >> n >> m;
    vector<string> v(n);
    vector<vector<int>> ans(n, vector<int>(m, 0));
    vector<vector<int>> g(n * m);
    for (int j = 0; j < n; ++j) {
      cin >> v[j];
    }
    for (int j = 1; j < n - 1; ++j) {
      for (int k = 1; k < m - 1; ++k) {
        if (v[j][k] == 'X') {
          int c = 0;
          vector<int> cell;
          for (auto &d : neigh) {
            int dx = d[0], dy = d[1];
            if (v[j + dx][k + dy] == '.') {
              ++c;
              cell.push_back((j + dx) * m + k + dy);
            }
          }
          if (c % 2 != 0) {
            goto error;
          } else if (c == 2) {
            g[cell[0]].push_back(cell[1]);
            g[cell[1]].push_back(cell[0]);
          } else if (c == 4) {
            g[cell[0]].push_back(cell[3]);
            g[cell[3]].push_back(cell[0]);
            g[cell[1]].push_back(cell[2]);
            g[cell[2]].push_back(cell[1]);
          }
        }
      }
    }
    for (int j = 0; j < n; ++j) {
      for (int k = 0; k < m; ++k) {
        int id = j * m + k;
        if (v[j][k] == '.' && ans[j][k] == 0) {
          list<int> q;
          q.push_back(id);
          ans[j][k] = 1;
          while (!q.empty()) {
            int p = q.front();
            int x = p / m, y = p % m;
            q.pop_front();
            for (auto next : g[p]) {
              int nx = next / m, ny = next % m;
              if (ans[nx][ny] == 0) {
                ans[nx][ny] = 5 - ans[x][y];
                q.push_back(next);
              }
            }
          }
        }
      }
    }
    printf("YES\n");
    for (int j = 0; j < n; ++j) {
      for (int k = 0; k < m; ++k) {
        if (ans[j][k] == 0) {
          for (auto &d : neigh) {
            int dx = d[0], dy = d[1];
            if (v[j + dx][k + dy] == '.') {
              ans[j][k] += ans[j + dx][k + dy];
            }
          }
        }
        printf("%d ", ans[j][k]);
      }
      printf("\n");
    }
    continue;
  error:
    printf("NO\n");
  }
  return 0;
}

```