#include <bits/stdc++.h>
using namespace std;
const int maxn = 131072;
struct Obj {};
void solve() {
  int n, m;
  cin >> n >> m;
  vector<vector<char>> field(n, vector<char>(m));
  vector<vector<int>> colors(n, vector<int>(m, -1));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> field[i][j];
    }
  }
  vector<vector<pair<int, int>>> cmps;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m - 1; j++) {
      if (field[i][j] == '.' && field[i][j + 1] == '.') {
        colors[i][j] = cmps.size();
        colors[i][j + 1] = cmps.size();
        field[i][j] = field[i][j + 1] = '#';
        cmps.push_back({{i, j}, {i, j + 1}});
      }
    }
  }
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < m; j++) {
      if (field[i][j] == '.' && field[i + 1][j] == '.') {
        colors[i][j] = cmps.size();
        colors[i + 1][j] = cmps.size();
        field[i][j] = field[i + 1][j] = '#';
        cmps.push_back({{i, j}, {i + 1, j}});
      }
    }
  }
  vector<pair<int, int>> perim = {{-1, 0}, {0, 1}, {0, -1}, {1, 0}};
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (field[i][j] != '.') continue;
      bool flag = false;
      for (int k = 0; k < perim.size(); k++) {
        int new_i = i + perim[k].first;
        int new_j = j + perim[k].second;
        if (new_i < 0 || new_i >= n || new_j < 0 || new_j >= m) continue;
        if (colors[new_i][new_j] != -1) {
          colors[i][j] = colors[new_i][new_j];
          cmps[colors[i][j]].push_back({i, j});
          flag = true;
          break;
        }
      }
      if (!flag) {
        cout << -1;
        return;
      }
    }
  }
  for (int i = 0; i < cmps.size(); i++) {
    set<int> avail;
    for (int j = '0'; j <= '9'; j++) {
      avail.insert(j);
    }
    for (int j = 0; j < cmps[i].size(); j++) {
      for (int k = 0; k < perim.size(); k++) {
        int new_i = cmps[i][j].first + perim[k].first;
        int new_j = cmps[i][j].second + perim[k].second;
        if (new_i < 0 || new_i >= n || new_j < 0 || new_j >= m) continue;
        avail.erase(field[new_i][new_j]);
      }
    }
    char color = *avail.begin();
    for (int j = 0; j < cmps[i].size(); j++) {
      field[cmps[i][j].first][cmps[i][j].second] = color;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << field[i][j];
    }
    cout << "\n";
  }
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  solve();
  return 0;
}
