Artem is building a new robot. He has a matrix a consisting of n rows and m columns. The cell located on the i-th row from the top and the j-th column from the left has a value a_{i,j} written in it. 

If two adjacent cells contain the same value, the robot will break. A matrix is called good if no two adjacent cells contain the same value, where two cells are called adjacent if they share a side. 

Artem wants to increment the values in some cells by one to make a good.

More formally, find a good matrix b that satisfies the following condition — 

  * For all valid (i,j), either b_{i,j} = a_{i,j} or b_{i,j} = a_{i,j}+1. 



For the constraints of this problem, it can be shown that such a matrix b always exists. If there are several such tables, you can output any of them. Please note that you do not have to minimize the number of increments.

Input

Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 10). Description of the test cases follows.

The first line of each test case contains two integers n, m (1 ≤ n ≤ 100, 1 ≤ m ≤ 100) — the number of rows and columns, respectively.

The following n lines each contain m integers. The j-th integer in the i-th line is a_{i,j} (1 ≤ a_{i,j} ≤ 10^9).

Output

For each case, output n lines each containing m integers. The j-th integer in the i-th line is b_{i,j}.

Example

Input


3
3 2
1 2
4 5
7 8
2 2
1 1
3 3
2 2
1 3
2 2


Output


1 2
5 6
7 8
2 1
4 3
2 4
3 2

Note

In all the cases, you can verify that no two adjacent cells have the same value and that b is the same as a with some values incremented by one. 
#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000000 + 7;
const long long int MOD1 = 998244353;
long long int pwr(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a *= a;
    b >>= 1;
  }
  return res;
}
const long long int sss = pwr(2, 32);
long long int strTo(string s) {
  stringstream tmp(s);
  long long int x = 0;
  tmp >> x;
  return x;
}
string NoTo(long long int n) {
  ostringstream str1;
  str1 << n;
  string ans = str1.str();
  return ans;
}
vector<bool> sieve(4000001, true);
void Sieve() {
  sieve[0] = false;
  sieve[1] = false;
  for (long long int i = 2; i * i <= 4000000; i++) {
    if (sieve[i] == true) {
      for (long long int j = i * i; j <= 4000000; j += i) sieve[j] = false;
    }
  }
}
long long int nCr(long long int n, long long int r) {
  long long int ans = 1;
  for (long long int i = (long long int)0; i < (long long int)r; i++) {
    ans = (ans * (n - i));
    ans = (ans / (i + 1));
  }
  return ans;
}
long long int pwrm(long long int a, long long int b, long long int m) {
  a %= m;
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
vector<long long int> adj[300010];
long long int dista[100001];
long long int vis[300010];
long long int par[300001];
long long int cl[100001];
long long int sz = 1;
long long int n, q;
long long int arr[10000001];
void init(long long int n) {
  while (sz < n) sz *= 2;
}
vector<long long int> sum(10000010);
void build(long long int a[], long long int x, long long int l,
           long long int r) {
  if (r - l == 1) {
    sum[x] = a[l];
    return;
  }
  long long int m = (l + r) / 2;
  build(a, 2 * x + 1, l, m);
  build(a, 2 * x + 2, m, r);
  sum[x] = max(sum[2 * x + 1], sum[2 * x + 2]);
}
void buil(long long int a[], long long int x, long long int l,
          long long int r) {
  build(a, x, l, r);
}
long long int suf(long long int l, long long int r, long long int x,
                  long long int lx, long long int rx) {
  if (lx >= r || l >= rx) return 0;
  if (lx >= l && rx <= r) return sum[x];
  long long int m = (lx + rx) / 2;
  return max(suf(l, r, 2 * x + 1, lx, m), suf(l, r, 2 * x + 2, m, rx));
}
long long int su(long long int l, long long int r, long long int x,
                 long long int lx, long long int rx) {
  return suf(l, r, x, lx, rx);
}
long long int ar[1000010];
long long int get(long long int k) {
  long long int sum = 0;
  while (k >= 1) {
    sum += ar[k];
    k -= k & -k;
  }
  return sum;
}
void update(long long int in, long long int vl) {
  while (in <= 1000010) {
    ar[in] += vl;
    in += in & -in;
  }
}
long long int sizee[200010] = {0};
long long int ctr = 0;
void df(long long int sr) {
  vis[sr] = 1;
  long long int ctr = 0;
  for (auto it : adj[sr]) {
    if (!vis[it]) {
      df(it);
      ctr += (1 + sizee[it]);
    }
  }
  sizee[sr] = ctr;
}
long long int fac[2000010];
unsigned long long modInverse(unsigned long long n, int p) {
  return pwrm(n, p - 2, p);
}
long long int level[300001];
void dfs(long long int sr, long long int pr, long long int pa) {
  vis[sr] = 1;
  level[sr] = pr;
  par[sr] = pa;
  for (auto it : adj[sr]) {
    if (!vis[it]) dfs(it, pr + 1, sr);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int T;
  cin >> T;
  while (T--) {
    long long int n, m;
    cin >> n >> m;
    long long int a[n][m];
    long long int b[n][m];
    queue<pair<long long int, long long int>> q;
    for (long long int i = (long long int)0; i < (long long int)n; i++) {
      for (long long int j = (long long int)0; j < (long long int)m; j++) {
        cin >> a[i][j];
        b[i][j] = a[i][j];
      }
    }
    for (long long int i = (long long int)0; i < (long long int)n; i++) {
      for (long long int j = (long long int)0; j < (long long int)m; j++) {
        long long int cx = 0;
        if (j < m - 1 && a[i][j] == a[i][j + 1]) {
          q.push({i, j + 1});
          cx++;
        }
        if (j > 0 && a[i][j] == a[i][j - 1]) {
          q.push({i, j - 1});
          cx++;
        }
        if (i < n - 1 && a[i][j] == a[i + 1][j]) {
          q.push({i + 1, j});
          cx++;
        }
        if (i > 0 && a[i][j] == a[i - 1][j]) {
          q.push({i - 1, j});
          cx++;
        }
        if (cx > 0) q.push({i, j});
      }
    }
    long long int vis[n][m];
    for (long long int i = (long long int)0; i < (long long int)n; i++) {
      for (long long int j = (long long int)0; j < (long long int)m; j++)
        vis[i][j] = 0;
    }
    while (!q.empty()) {
      pair<long long int, long long int> fr = q.front();
      long long int i = fr.first;
      long long int j = fr.second;
      long long int ctr = 0;
      if (j < m - 1 && b[i][j] == b[i][j + 1]) {
        ctr++;
      }
      if (j > 0 && b[i][j] == b[i][j - 1]) {
        ctr++;
      }
      if (i < n - 1 && b[i][j] == b[i + 1][j]) {
        ctr++;
      }
      if (i > 0 && b[i][j] == b[i - 1][j]) {
        ctr++;
      }
      if (ctr == 0)
        q.pop();
      else {
        if (!vis[fr.first][fr.second]) {
          b[fr.first][fr.second]++;
          vis[i][j] = 1;
          q.pop();
          if (j < m - 1 && b[i][j] == b[i][j + 1]) {
            q.push({i, j + 1});
          }
          if (j > 0 && b[i][j] == b[i][j - 1]) {
            q.push({i, j - 1});
          }
          if (i < n - 1 && b[i][j] == b[i + 1][j]) {
            q.push({i + 1, j});
          }
          if (i > 0 && b[i][j] == b[i - 1][j]) {
            q.push({i - 1, j});
          }
        } else {
          q.pop();
          if (j < m - 1 && b[i][j] == b[i][j + 1]) {
            b[i][j + 1]++;
            vis[i][j + 1]++;
            if (j + 2 < m && b[i][j + 1] == b[i][j + 2]) {
              q.push({i, j + 2});
            }
            if (i < n - 1 && b[i][j + 1] == b[i + 1][j]) {
              q.push({i + 1, j + 1});
            }
            if (i > 0 && b[i][j + 1] == b[i - 1][j]) {
              q.push({i - 1, j + 1});
            }
          }
          if (j > 0 && b[i][j] == b[i][j - 1]) {
            vis[i][j - 1]++;
            b[i][j - 1]++;
            if (j - 2 >= 0 && b[i][j - 1] == b[i][j - 2]) {
              q.push({i, j - 2});
            }
            if (i < n - 1 && b[i][j - 1] == b[i + 1][j - 1]) {
              q.push({i + 1, j - 1});
            }
            if (i > 0 && b[i][j - 1] == b[i - 1][j - 1]) {
              q.push({i - 1, j - 1});
            }
          }
          if (i < n - 1 && b[i][j] == b[i + 1][j]) {
            vis[i + 1][j]++;
            b[i + 1][j]++;
            if (j < m - 1 && b[i + 1][j] == b[i + 1][j + 1]) {
              q.push({i + 1, j + 1});
            }
            if (j > 0 && b[i + 1][j] == b[i + 1][j - 1]) {
              q.push({i + 1, j - 1});
            }
            if (i + 2 < n && b[i + 1][j] == b[i + 2][j]) {
              q.push({i + 2, j});
            }
          }
          if (i > 0 && b[i][j] == b[i - 1][j]) {
            vis[i - 1][j]++;
            b[i - 1][j]++;
            if (j < m - 1 && b[i - 1][j] == b[i - 1][j + 1]) {
              q.push({i - 1, j + 1});
            }
            if (j > 0 && b[i - 1][j] == b[i - 1][j - 1]) {
              q.push({i - 1, j - 1});
            }
            if (i - 2 >= 0 && b[i - 1][j] == b[i - 2][j]) {
              q.push({i - 2, j});
            }
          }
        }
      }
    }
    for (long long int i = (long long int)0; i < (long long int)n; i++) {
      for (long long int j = (long long int)0; j < (long long int)m; j++)
        cout << b[i][j] << " ";
      cout << "\n";
    }
  }
  cerr << "Time Elapsed : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
       << "ms\n";
  return 0;
}
