#include <bits/stdc++.h>
using namespace std;
long long n, m;
char s[1005][1005];
signed main() {
  cin >> n >> m;
  for (long long i = 1; i <= n; scanf("%s", s[i] + 1), i++)
    ;
  for (long long i = 1; i <= n; i++) {
    long long cnt = 0;
    for (long long j = 1; j <= m; j++)
      if (s[i][j] == '.') {
        if (j < m && s[i][j + 1] == '.')
          s[i][j] = s[i][j + 1] = 3 * (i % 3) + cnt % 3 + '0';
        else if (i < n && s[i + 1][j] == '.')
          s[i][j] = s[i + 1][j] = 3 * (i % 3) + cnt % 3 + '0';
        if (s[i][j] != '.') cnt++;
      }
  }
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= m; j++)
      if (s[i][j] == '.') {
        if (i > 1 && isdigit(s[i - 1][j]))
          s[i][j] = s[i - 1][j];
        else if (j > 1 && isdigit(s[i][j - 1]))
          s[i][j] = s[i][j - 1];
        else if (i < n && isdigit(s[i + 1][j]))
          s[i][j] = s[i + 1][j];
        else if (j < m && isdigit(s[i][j + 1]))
          s[i][j] = s[i][j + 1];
        else
          return puts("-1"), 0;
      }
  for (long long i = 1; i <= n; puts(""), i++)
    for (long long j = 1; j <= m; j++) cout << s[i][j];
  return 0;
}
