#include <bits/stdc++.h>
using namespace std;
int N, M, cnt[1001][1001], n, t[500001];
char mat[1001][1001];
int main() {
  scanf("%d %d", &N, &M);
  for (int i = 0; i < N; ++i) {
    scanf("%s", mat[i]);
    for (int j = 0; j < M; ++j)
      if (mat[i][j] == '#') cnt[i][j] = -1;
  }
  for (int i = 0; i < N - 1; ++i)
    for (int j = 0; j < M; ++j)
      if (!cnt[i][j] && !cnt[i + 1][j])
        cnt[i][j] = cnt[i + 1][j] =
            (((i + j) % 2) ? 3 * (i % 3) + j % 3 + 1
                           : 3 * ((i + 1) % 3) + j % 3 + 1);
  for (int j = 0; j < M - 1; ++j)
    for (int i = 0; i < N; ++i)
      if (!cnt[i][j] && !cnt[i][j + 1])
        cnt[i][j] = cnt[i][j + 1] =
            (((i + j) % 2) ? 3 * (i % 3) + j % 3 + 1
                           : 3 * ((i + 1) % 3) + j % 3 + 1);
  for (int i = 0; i < N; ++i)
    for (int j = 0; j < M; ++j)
      if (!cnt[i][j]) {
        if (i && cnt[i - 1][j] > 0)
          cnt[i][j] = cnt[i - 1][j];
        else if (j && cnt[i][j - 1] > 0)
          cnt[i][j] = cnt[i][j - 1];
        else if (i < N - 1 && cnt[i + 1][j] > 0)
          cnt[i][j] = cnt[i + 1][j];
        else if (j < M - 1 && cnt[i][j + 1] > 0)
          cnt[i][j] = cnt[i][j + 1];
        else {
          printf("-1");
          return 0;
        }
      }
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < M; ++j) {
      if (cnt[i][j] == -1)
        printf("#");
      else
        printf("%d", cnt[i][j]);
    }
    printf("\n");
  }
  return 0;
}
