Problem: Physicist Woll likes to play one relaxing game in between his search of the theory of everything.

Game interface consists of a rectangular n × m playing field and a dashboard. Initially some cells of the playing field are filled while others are empty. Dashboard contains images of all various connected (we mean connectivity by side) figures of 2, 3, 4 and 5 cells, with all their rotations and reflections. Player can copy any figure from the dashboard and place it anywhere at the still empty cells of the playing field. Of course any figure can be used as many times as needed.

Woll's aim is to fill the whole field in such a way that there are no empty cells left, and also... just have some fun.

Every initially empty cell should be filled with exactly one cell of some figure. Every figure should be entirely inside the board.

<image>

In the picture black cells stand for initially filled cells of the field, and one-colour regions represent the figures.

Input

First line contains integers n and m (1 ≤ n, m ≤ 1000) — the height and the width of the field correspondingly. Next n lines contain m symbols each. They represent the field in a natural way: j-th character of the i-th line is "#" if the corresponding cell is filled, and "." if it is empty.

Output

If there is no chance to win the game output the only number "-1" (without the quotes). Otherwise output any filling of the field by the figures in the following format: each figure should be represented by some digit and figures that touch each other by side should be represented by distinct digits. Every initially filled cell should be represented by "#".

Examples

Input

2 3
...
#.#


Output

000
#0#


Input

3 3
.#.
...
..#


Output

5#1
511
55#


Input

3 3
...
.##
.#.


Output

-1


Input

1 2
##


Output

##

Note

In the third sample, there is no way to fill a cell with no empty neighbours.

In the forth sample, Woll does not have to fill anything, so we should output the field from the input.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 100;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
struct edge {
  int x, y, xx, yy;
  edge() {}
  edge(int xxx, int yyy, int xxxx, int yyyy) {
    x = xxx;
    y = yyy;
    xx = xxxx;
    yy = yyyy;
  }
};
int n, m, ted;
char a[maxn][maxn];
int mark[maxn][maxn];
vector<pair<int, int> > v[2 * maxn * maxn], vv[7];
vector<edge> e[maxn * maxn];
bool vis[20], see[maxn][maxn];
void dfs(int v1, int v2, int sz, int com) {
  see[v1][v2] = true;
  vv[com].push_back(make_pair(v1, v2));
  for (int i = 0; i < e[sz].size(); i++)
    if (vis[i]) {
      if (e[sz][i].x == v1 && e[sz][i].y == v2)
        if (!see[e[sz][i].xx][e[sz][i].yy])
          dfs(e[sz][i].xx, e[sz][i].yy, sz, com);
      if (e[sz][i].xx == v1 && e[sz][i].yy == v2)
        if (!see[e[sz][i].x][e[sz][i].y]) dfs(e[sz][i].x, e[sz][i].y, sz, com);
    }
}
bool check(int sz) {
  int cnt = 0;
  for (int i = 0; i <= 6; i++) vv[i].clear();
  for (int i = 0; i < v[sz].size(); i++)
    if (!see[v[sz][i].first][v[sz][i].second])
      dfs(v[sz][i].first, v[sz][i].second, sz, cnt++);
  for (int i = 0; i < v[sz].size(); i++)
    see[v[sz][i].first][v[sz][i].second] = false;
  int num[7];
  memset(num, 0, sizeof num);
  for (int i = 0; i < cnt; i++) num[vv[i].size()]++;
  if (v[sz].size() == 6) {
    if ((num[2] == 1 && num[4] == 1) || num[2] == 3 || (num[3] == 2)) {
      v[sz].clear();
      for (int i = 0; i < cnt; i++) {
        ted++;
        for (int j = 0; j < v[i].size(); j++)
          mark[v[i][j].first][v[i][j].second] = ted;
        v[ted] == vv[i];
      }
      return true;
    }
  } else if (v[sz].size() == 5) {
    if (num[2] == 1 && num[3] == 1) {
      v[sz].clear();
      for (int i = 0; i < cnt; i++) {
        ted++;
        for (int j = 0; j < v[i].size(); j++)
          mark[v[i][j].first][v[i][j].second] = ted;
        v[ted] = vv[i];
      }
      return true;
    }
  } else if (v[sz].size() == 4)
    if (num[2] == 2) {
      v[sz].clear();
      for (int i = 0; i < cnt; i++) {
        ted++;
        for (int j = 0; j < v[i].size(); j++)
          mark[v[i][j].first][v[i][j].second] = ted;
        v[ted] = vv[i];
      }
      return true;
    }
}
bool bomb = false;
void bt(int step, int sz) {
  if (step == v[sz].size()) {
    if (!bomb) bomb = check(sz);
    return;
  }
  bt(step + 1, sz);
  vis[step] = true;
  bt(step + 1, sz);
  vis[step] = false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> a[i][j];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (a[i][j] == '.' && !mark[i][j]) {
        int cnt1 = 0;
        for (int l = 0; l < 4; l++) {
          int x = i + dx[l], y = j + dy[l];
          if (a[x][y] == '.') cnt1++;
          if (!mark[i][j] && a[x][y] == '.' && !mark[x][y]) {
            ted++;
            v[ted].push_back(make_pair(i, j));
            v[ted].push_back(make_pair(x, y));
            e[ted].push_back(edge(i, j, x, y));
            mark[i][j] = ted;
            mark[x][y] = ted;
          }
        }
        if (cnt1 == 0) {
          cout << "-1" << endl;
          return 0;
        }
      }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (a[i][j] == '.' && !mark[i][j])
        for (int l = 0; l < 4; l++)
          if (!mark[i][j] && mark[i + dx[l]][j + dy[l]]) {
            mark[i][j] = mark[i + dx[l]][j + dy[l]];
            e[mark[i][j]].push_back(edge(i, j, i + dx[l], j + dy[l]));
            v[mark[i][j]].push_back(make_pair(i, j));
          }
  for (int i = 1; i <= ted; i++)
    if (v[i].size() >= 4) bt(0, i);
  for (int i = 1; i <= ted; i++)
    if (v[i].size()) {
      bool col[10];
      memset(col, 0, sizeof col);
      int com = mark[v[i][0].first][v[i][0].second];
      for (int j = 0; j < v[i].size(); j++)
        for (int l = 0; l < 4; l++) {
          int v1 = dx[l] + v[i][j].first, v2 = dy[l] + v[i][j].second;
          if (a[v1][v2] >= '0' && a[v1][v2] <= '9') col[a[v1][v2] - '0'] = true;
        }
      for (int j = 0; j <= 9; j++)
        if (!col[j]) {
          for (int l = 0; l < v[i].size(); l++)
            a[v[i][l].first][v[i][l].second] = char('0' + j);
          break;
        }
    }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cout << a[i][j];
    cout << endl;
  }
  return 0;
}