Problem: In this problem you will need to deal with an n × m grid graph. The graph's vertices are the nodes of the n × m grid. The graph's edges are all the sides and diagonals of the grid's unit squares.

The figure below shows a 3 × 5 graph. The black lines are the graph's edges, the colored circles are the graph's vertices. The vertices of the graph are painted on the picture for a reason: the coloring is a correct vertex coloring of the 3 × 5 graph into four colors. A graph coloring is correct if and only if each vertex is painted and no two vertices connected by an edge are painted the same color.

<image>

You are given the size of the grid graph n × m and the colors of some of its vertices. Find any way how to paint the unpainted vertices of the graph in 4 colors to make the final coloring a correct vertex graph coloring. If there is no such correct vertex coloring, say that the answer doesn't exist.

Input

The first line contains two integers n and m (2 ≤ n, m ≤ 1000). Each of the next n lines consists of m characters — the given graph. Each character is either «0», «1», «2», «3», «4». Character «0» means that the corresponding vertex is unpainted, otherwise the character means the color of the vertex.

Assume that all the available colors are numbered from 1 to 4.

Output

If there is no way to get correct vertex coloring of the graph, print 0 in a single line. Otherwise print the colored n × m graph. Print the graph in the same format as in the input.

If multiple answers exist, print any of them.

Examples

Input

3 5
10101
00020
01000


Output

13131
42424
31313


Input

2 2
00
00


Output

12
34


Input

2 2
11
00


Output

0

Note

The answer to the first sample is shown on the picture (1 — green color, 2 — blue, 3 — dark blue, 4 — pink).

In the second sample there exists 4! answers, each of them is considered correct.

In the third sample two vertices with equal colors are connected. So the correct vertex coloring couldn't be obtained.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const double EPS = 1e-8;
const double PI = acos(-1);
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
ostream &operator<<(ostream &o, const vector<T> &t) {
  o << '[';
  for (__typeof((t).begin()) i = (t).begin(); i != (t).end(); ++i) {
    if (i != t.begin()) o << ',';
    o << *i;
  }
  return o << ']';
}
template <class S, class T>
ostream &operator<<(ostream &o, const pair<S, T> &t) {
  return o << '(' << t.first << ',' << t.second << ')';
}
template <int N, class Tp>
void out(ostream &, const Tp &) {}
template <int N, class Tp, class, class... Ts>
void out(ostream &o, const Tp &t) {
  if (N) o << ',';
  o << get<N>(t);
  out<N + 1, Tp, Ts...>(o, t);
}
template <class... Ts>
ostream &operator<<(ostream &o, const tuple<Ts...> &t) {
  o << '(';
  out<0, tuple<Ts...>, Ts...>(o, t);
  return o << ')';
}
template <class T>
void output(T *a, int n) {
  for (int i = 0; i < (int)(n); ++i) {
    if (i) cout << ',';
    cout << a[i];
  }
  cout << endl;
}
template <class T>
void output(T *a, int n, int m) {
  for (int i = 0; i < (int)(n); ++i) output(a[i], m);
}
template <class T>
void output(T t) {
  if (t < 0) t = -t, putchar('-');
  static int c[20];
  int k = 0;
  while (t) c[k++] = t % 10, t /= 10;
  if (!k) c[k++] = 0;
  while (k) putchar(c[--k] ^ 48);
}
template <class S, class... T>
void output(S a, T... t) {
  output(a);
  putchar(' ');
  output(t...);
}
template <class T>
bool input(T &t) {
  t = 0;
  int n = 0, c;
  while (~(c = getchar()) && !isdigit(c) && c != '-')
    ;
  if (!~c) return 0;
  if (c == '-')
    n = 1;
  else
    t = c ^ 48;
  while (isdigit(c = getchar())) t = 10 * t + c - '0';
  t = n ? -t : t;
  return 1;
}
template <class S, class... T>
bool input(S &a, T &...t) {
  input(a);
  return input(t...);
}
int a[1000][1000];
int t[1000][1000];
int ans[1000][1000];
int h, w;
bool sub() {
  for (int x1 = 0; x1 < (int)(4); ++x1) {
    for (int x2 = 0; x2 < (int)(x1); ++x2) {
      bool ok = 1;
      for (int i = 0; i < (int)(h); ++i) {
        int c1 = -1, c2 = -1;
        if (i & 1) {
          c1 = x1;
          c2 = x2;
        } else {
          int S = 1 << x1 | 1 << x2;
          for (int i = 0; i < (int)(4); ++i)
            if (!(S >> i & 1)) {
              if (c1 == -1)
                c1 = i;
              else
                c2 = i;
            }
        }
        int S1 = 0, S2 = 0;
        for (int j = 0; j < (int)(w); ++j) {
          if (a[i][j] == -1) continue;
          if (j & 1)
            S1 |= 1 << a[i][j];
          else
            S2 |= 1 << a[i][j];
        }
        if ((S2 >> c1 & 1) || (S1 >> c2 & 1)) {
          swap(c1, c2);
        }
        bool dame = 0;
        for (int j = 0; j < (int)(w); ++j) {
          if (j & 1) {
            if (!(a[i][j] == -1 || a[i][j] == c1)) dame = 1;
            ans[i][j] = c1;
          } else {
            if (!(a[i][j] == -1 || a[i][j] == c2)) dame = 1;
            ans[i][j] = c2;
          }
        }
        if (dame) {
          ok = 0;
          break;
        }
      }
      if (ok) {
        return 1;
      }
    }
  }
  return 0;
}
bool solve() {
  if (sub()) return 1;
  for (int i = 0; i < (int)(h); ++i)
    for (int j = 0; j < (int)(w); ++j) t[j][h - 1 - i] = a[i][j];
  for (int i = 0; i < (int)(w); ++i)
    for (int j = 0; j < (int)(h); ++j) a[i][j] = t[i][j];
  swap(h, w);
  if (sub()) {
    for (int i = 0; i < (int)(h); ++i)
      for (int j = 0; j < (int)(w); ++j) t[w - 1 - j][i] = ans[i][j];
    for (int i = 0; i < (int)(w); ++i)
      for (int j = 0; j < (int)(h); ++j) ans[i][j] = t[i][j];
    swap(h, w);
    return 1;
  }
  return 0;
}
int main() {
  while (input(h, w)) {
    for (int i = 0; i < (int)(h); ++i)
      for (int j = 0; j < (int)(w); ++j) {
        char c;
        scanf(" %c ", &c);
        if (c == '0')
          a[i][j] = -1;
        else
          a[i][j] = c - '1';
      }
    if (solve()) {
      for (int i = 0; i < (int)(h); ++i) {
        for (int j = 0; j < (int)(w); ++j) putchar(ans[i][j] + '1');
        putchar('\n');
      }
    } else
      puts("0");
  }
}