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;
static const int bitindex_map[32] = {};
const int dir[][2] = {{-1, 0}, {0, 1},  {1, 0},  {0, -1},
                      {1, 1},  {1, -1}, {-1, 1}, {-1, -1}};
const char dname[] = "NWSE";
template <typename T>
inline void updateMax(T& a, const T& b) {
  a = max(a, b);
}
template <typename T>
inline void updateMin(T& a, const T& b) {
  a = min(a, b);
}
template <typename T>
inline vector<T> erase(vector<T> table, int ind) {
  assert(ind < table.size());
  table.erase(table.begin() + ind);
  return table;
}
template <typename T>
vector<T> unique(vector<T> table) {
  sort(table.begin(), table.end());
  vector<T> res;
  unique_copy(table.begin(), table.end(), back_inserter(res));
  return res;
}
template <typename A, typename B>
ostream& operator<<(ostream& out, const pair<A, B>& pp) {
  out << "(" << pp.first << "," << pp.second << ")";
  return out;
}
template <typename A, typename B>
istream& operator<<(istream& in, pair<A, B>& pp) {
  cerr << "A pair wanted" << endl;
  in >> pp.first >> pp.second;
  return in;
}
template <typename T>
ostream& operator<<(ostream& out, const vector<T>& vect) {
  copy(vect.begin(), vect.end(), ostream_iterator<T>(out, " "));
  return out;
  out << "length = " << vect.size() << endl;
  for (int i = 0; i < vect.size(); i++) out << vect[i] << " ";
  out << endl;
  return out;
}
ostream& operator<<(ostream& out, const vector<string>& vect) {
  out << vect.size() << " X " << vect[0].length() << endl;
  for (int i = 0; i < vect.size(); i++) out << vect[i] << endl;
  return out;
}
template <typename T>
istream& operator>>(istream& in, vector<T>& vect) {
  vect.clear();
  int n;
  cerr << "A integer of length wanted" << endl;
  in >> n;
  vect.resize(n);
  cerr << n << " elements wanted" << endl;
  for (int i = 0; i < n; i++) in >> vect[i];
  return in;
}
template <typename T>
ostream& operator<<(ostream& out, const vector<vector<T> >& vect) {
  out << "row number=" << vect.size() << endl;
  for (int i = 0; i < vect.size(); i++) {
    out << "row #" << i << ":";
    for (int j = 0; j < vect[i].size(); j++) out << " " << vect[i][j];
    out << endl;
  }
  return out;
}
template <typename T>
istream& operator>>(istream& in, vector<vector<T> >& vect) {
  vect.clear();
  int n, m;
  cerr << "Two integers wanted" << endl;
  in >> n >> m;
  vect.resize(n);
  cerr << "A matrix " << n << " X " << m << " wanted" << endl;
  for (int i = 0; i < n; i++) {
    vect[i].resize(m);
    for (int j = 0; j < m; j++) in >> vect[i][j];
  }
  return in;
}
template <class T>
string convert(T vv) {
  ostringstream re;
  re << vv;
  return re.str();
}
template <typename T>
T convert(const string& ss) {
  istringstream is(ss);
  T tmp;
  is >> tmp;
  return tmp;
}
template <class T>
string convert(vector<T> vv) {
  ostringstream re;
  for (int i = 0; i < vv.size(); i++) {
    if (i) re << " ";
    re << vv[i];
  }
  return re.str();
}
template <class T>
vector<T> parse(const string& ss, const char* cut = " ") {
  vector<T> re;
  for (int j = 0; j < ss.size(); j++) {
    string s;
    while (j < ss.size() && NULL == strchr(cut, ss[j])) s += ss[j++];
    if (!s.empty()) {
      T tmp;
      istringstream is(s);
      is >> tmp;
      re.push_back(tmp);
    }
  }
  return re;
}
template <>
vector<string> parse(const string& ss, const char* cut) {
  vector<string> re;
  for (int j = 0; j < ss.size(); j++) {
    string s;
    while (j < ss.size() && NULL == strchr(cut, ss[j])) s += ss[j++];
    if (!s.empty()) {
      re.push_back(s);
    }
  }
  return re;
}
int countBit(int n) {
  return __builtin_popcount(n);
  int re = 0;
  while (n) re++, n ^= ((((n) ^ ((n)-1)) & n));
  return re;
}
int MSB(int n) {
  if (n == 0) return 0;
  while (((((n) ^ ((n)-1)) & n)) != n) n ^= ((((n) ^ ((n)-1)) & n));
  return n;
}
void initHash(int n, int hash[]) {
  for (int i = 0; i < n; i++) hash[((1) << (i))] = i;
}
void initBcnt(int n, int bcnt[]) {
  bcnt[0] = 0;
  for (int i = 1; i < ((1) << (n)); i++)
    bcnt[i] = bcnt[i ^ ((((i) ^ ((i)-1)) & i))] + 1;
}
int print(int aa[]) { return 0; }
template <typename T>
vector<pair<T, T> > interval_union(vector<pair<T, T> > all) {
  vector<pair<T, T> > res;
  if (all.empty()) return res;
  sort(all.begin(), all.end());
  res.push_back(all[0]);
  for (int i = 1; i < all.size(); i++) {
    if (all[i].first <= res.back().second) {
      res.back().second = max(res.back().second, all[i].second);
    } else {
      res.push_back(all[i]);
    }
  }
  return res;
}
template <typename T>
class CPoint : public complex<T> {
 public:
  CPoint(const T& x = T(), const T& y = T()) : complex<T>(x, y){};
  T& x() { return complex<T>::real(); }
  T& y() { return complex<T>::imag(); }
};
template <typename T>
vector<T> set_diff(vector<T>& a, vector<T>& b) {
  vector<T> c;
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  set_difference(a.begin(), a.end(), b.begin(), b.end(),
                 inserter(c, c.begin()));
  return c;
}
template <typename T>
ostream& operator<<(ostream& out, const valarray<T>& val) {
  for (int i = 0; i < val.size(); i++) {
    cout << val[i] << " ";
  }
  return out;
}
vector<string> transpose(const vector<string>& grid) {
  vector<string> res((grid[0].size()), string((grid.size()), ' '));
  for (int i = 0; i < grid.size(); i++)
    for (int j = 0; j < grid[i].size(); j++) {
      res[j][i] = grid[i][j];
    }
  return res;
}
double nextGaussian() {
  double x, y, r;
  for (;;) {
    x = 2.0 * rand() / (RAND_MAX + 1.0) - 1.0;
    y = 2.0 * rand() / (RAND_MAX + 1.0) - 1.0;
    r = x * x + y * y;
    if (r >= 1.0) continue;
    break;
  }
  double re = sqrt(-2.0 * log(r) / (r)) * x;
  return re;
}
char grid[1001][1001];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < (n); ++i) scanf("%s", grid[i]);
  vector<pair<int, int> > single;
  for (int i = 0; i < (n); ++i) {
    char a = ((i % 3) * 2) + '0';
    char b = a + 1;
    for (char* p = strchr(grid[i], '.'); p; p = strchr(p, '.')) {
      char* bp = p;
      while (*p == '.') p++;
      if ((p - bp) == 1) {
        single.push_back(make_pair(i, bp - grid[i]));
      } else {
        while (p - bp > 3) {
          *bp++ = a;
          *bp++ = a;
          swap(a, b);
        }
        fill(bp, p, a);
        swap(a, b);
      }
    }
  }
  for (int c = 0; c < (m); ++c) {
    char x = '6', y = '7';
    for (int r = 0; r < n; r++) {
      if (grid[r][c] == '.') {
        int br = r;
        while (grid[r][c] == '.') r++;
        if (r - br == 1) {
          r = br;
          if ((r && grid[r - 1][c] != '#')) {
            grid[br][c] = grid[br - 1][c];
            if (c + 1 < m && grid[r - 1][c + 1] == grid[r][c] && c + 2 < m &&
                grid[r - 1][c + 2] == grid[r][c]) {
              grid[br][c] = grid[br - 1][c] = x;
              swap(x, y);
            }
          } else if ((r + 1 < n && grid[r + 1][c] != '#')) {
            grid[r][c] = grid[r + 1][c];
            if (c + 1 < m && grid[r + 1][c + 1] == grid[r][c] && c + 2 < m &&
                grid[r + 1][c + 2] == grid[r][c]) {
              grid[r][c] = grid[r + 1][c] = x;
              swap(x, y);
            }
          } else {
            cout << "-1" << endl;
            return 0;
          }
        } else {
          char a = '8', b = '9';
          while (r - br > 3) {
            grid[br++][c] = a;
            grid[br++][c] = a;
            swap(a, b);
          }
          while (br < r) grid[br++][c] = a;
        }
      }
    }
  }
  for (int i = 0; i < (n); ++i) printf("%s\n", grid[i]);
  return 0;
}