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;
template <class _T>
inline _T sqr(const _T& x) {
  return x * x;
}
template <class _T>
inline string tostr(const _T& a) {
  ostringstream os("");
  os << a;
  return os.str();
}
const long double PI = 3.1415926535897932384626433832795;
const long double EPS = 1e-11;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {-1, 0, 1, 0};
int n, m, k;
char a[1024][1024];
char a0[1024][1024];
int c[1024][1024];
bool u[1024][1024];
bool u2[12];
void dfs(int x, int y, int px, int py) {
  u[x][y] = true;
  int cnt = 0;
  int t[4] = {0, 1, 2, 3};
  for (int i = 0; i < (int)(4); i++) {
    swap(t[i], t[rand() % 4]);
  }
  for (int l1 = 0; l1 < (int)(4); l1++) {
    int l = t[l1];
    int xn = x + dx[l];
    int yn = y + dy[l];
    if (xn < 0 || xn >= n || yn < 0 || yn >= m || u[xn][yn] || a[xn][yn] == '#')
      continue;
    dfs(xn, yn, x, y);
    if (c[xn][yn] == -1) cnt++;
  }
  if (cnt) {
    for (int l = 0; l < (int)(4); l++) {
      int xn = x + dx[l];
      int yn = y + dy[l];
      if (xn < 0 || xn >= n || yn < 0 || yn >= m || a[xn][yn] == '#' ||
          c[xn][yn] != -1 || (xn == px && yn == py))
        continue;
      c[xn][yn] = k;
    }
    c[x][y] = k++;
  }
}
void dfs2(int x, int y, int col) {
  u[x][y] = true;
  for (int l = 0; l < (int)(4); l++) {
    int xn = x + dx[l];
    int yn = y + dy[l];
    if (xn < 0 || xn >= n || yn < 0 || yn >= m || a[xn][yn] == '#') continue;
    if (c[xn][yn] == col) {
      if (!u[xn][yn]) dfs2(xn, yn, col);
    } else if (a[xn][yn] != '.') {
      u2[a[xn][yn] - '0'] = true;
    }
  }
}
void dfs3(int x, int y, int col, int nc) {
  a[x][y] = '0' + nc;
  c[x][y] = -1;
  for (int l = 0; l < (int)(4); l++) {
    int xn = x + dx[l];
    int yn = y + dy[l];
    if (xn < 0 || xn >= n || yn < 0 || yn >= m || a[xn][yn] == '#') continue;
    if (c[xn][yn] == col) {
      dfs3(xn, yn, col, nc);
    }
  }
}
int check(int x, int y) {
  int ans = 1;
  u[x][y] = true;
  for (int l = 0; l < (int)(4); l++) {
    int xn = x + dx[l];
    int yn = y + dy[l];
    if (xn < 0 || xn >= n || yn < 0 || yn >= m || u[xn][yn] ||
        a[xn][yn] == '#' || a[xn][yn] != a[x][y])
      continue;
    ans += check(xn, yn);
  }
  return ans;
}
int check2(int x, int y) {
  int ans = 1;
  u[x][y] = true;
  for (int l = 0; l < (int)(4); l++) {
    int xn = x + dx[l];
    int yn = y + dy[l];
    if (xn < 0 || xn >= n || yn < 0 || yn >= m || u[xn][yn] ||
        a[xn][yn] == '#' || c[xn][yn] != c[x][y])
      continue;
    ans += check2(xn, yn);
  }
  return ans;
}
int main() {
  cout << setiosflags(ios::fixed) << setprecision(10);
  srand(672465);
  memset(c, 0xff, sizeof(c));
  scanf("%d%d", &n, &m);
  memset((a), 0, sizeof(a));
  for (int i = 0; i < (int)(n); i++) {
    scanf("%s", a[i]);
    a[i][m] = '\0';
  }
  memcpy(a0, a, sizeof(a));
  memset((u), 0, sizeof(u));
  k = 0;
  for (int i = 0; i < (int)(n); i++) {
    for (int j = 0; j < (int)(m); j++) {
      if (!u[i][j] && a[i][j] != '#') {
        dfs(i, j, -1, -1);
        if (c[i][j] == -1) {
          bool bb = true;
          for (int l = 0; l < (int)(4); l++) {
            int xn = i + dx[l];
            int yn = j + dy[l];
            if (xn < 0 || xn >= n || yn < 0 || yn >= m || a[xn][yn] == '#')
              continue;
            if (c[xn][yn] != -1) {
              c[i][j] = c[xn][yn];
              bb = false;
              break;
            }
          }
          if (bb) {
            puts("-1");
            return 0;
          }
        }
      }
    }
  }
  memset((u), 0, sizeof(u));
  for (int i = 0; i < (int)(n); i++) {
    for (int j = 0; j < (int)(m); j++) {
      if (!u[i][j] && a[i][j] != '#') {
        int cnt = check2(i, j);
        if (cnt < 2 || cnt > 5) {
        }
      }
    }
  }
  memset((u), 0, sizeof(u));
  for (int i = 0; i < (int)(n); i++) {
    for (int j = 0; j < (int)(m); j++) {
      if (a[i][j] == '.') {
        memset((u2), 0, sizeof(u2));
        dfs2(i, j, c[i][j]);
        bool bbb = true;
        for (int t = 0; t < (int)(12); t++) {
          if (!u2[t]) {
            dfs3(i, j, c[i][j], t);
            bbb = false;
            break;
          }
        }
        if (bbb) return 1;
      }
    }
  }
  memset((u), 0, sizeof(u));
  for (int i = 0; i < (int)(n); i++) {
    for (int j = 0; j < (int)(m); j++) {
      if (a0[i][j] == '#') {
        if (a[i][j] != '#') cout << "Botwa ! 1 !" << endl;
      } else {
        if (!isdigit(a[i][j])) cout << "Botwa ! 2 !" << endl;
      }
      if (a[i][j] != '#' && !isdigit(a[i][j]))
        cout << "a[" << i << "][" << j << "] = '" << a[i][j] << "'" << endl;
      if (!u[i][j] && a[i][j] != '#') {
        int cnt = check(i, j);
        if (cnt < 2 || cnt > 5) {
          for (int ii = (-4); ii <= (int)(4); ii++) {
            for (int jj = (-4); jj <= (int)(4); jj++) {
              if (i + ii >= 0 && j + jj >= 0) cout << a[i + ii][j + jj];
            }
            if (i + ii >= 0) cout << endl;
          }
          cout << "? " << cnt << " " << a[i][j] << endl;
        }
      }
    }
  }
  for (int i = 0; i < (int)(n); i++) {
    puts(a[i]);
  }
  return 0;
}