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. 
/**
 * 13-11-2020
 * Created by Himanshu
 **/

import java.util.*;
import java.io.*;
import java.math.*;

public class C1438 {
    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(System.out);
        Reader s = new Reader();
        int t = s.i();
        while (t-- > 0) {
            int n = s.i() , m= s.i();
            int [][] arr = new int[n][m];
            for (int i=0;i<n;i++)
                arr[i] = s.arr(m);
            int [][] b = new int[n][m];
            boolean [][] a;
            boolean [][] vis = new boolean[n][m];
            for (int i=0;i<n;i++) {
                for (int j=0;j<m;j++) {
                    if (b[i][j] == 0) {
                        a = new boolean[n][m];
                        if (fixit(arr,a,n,m,arr[i][j],i,j)) {
                            a = new boolean[n][m];
                            fix(arr,b,a,vis,n,m,arr[i][j],i,j);
                        } else {
                            a = new boolean[n][m];
                            if (!vis[i][j] && fixit(arr,a,n,m,arr[i][j]+1,i,j)) {
                                a = new boolean[n][m];
                                fix(arr,b,a,vis,n,m,arr[i][j]+1,i,j);
                            }
                        }
                    }
                }
            }
            for (int i=0;i<n;i++) {
                for (int j=0;j<m;j++) out.print(b[i][j] + " ");
                out.println();
            }
        }
        out.flush();
    }
    private static void fix (int [][] arr ,int [][] b ,boolean [][] a , boolean [][] vis ,int n , int m , int val , int i , int j) {
        a[i][j] = true;
        int x ;
        if (val == arr[i][j]) x = val + 1;
        else x = val - 1;
        if (i+1 < n && arr[i+1][j] == arr[i][j] && !a[i+1][j])
            fix(arr,b,a,vis,n,m,x,i+1,j);
        if (j+1 < m && arr[i][j+1] == arr[i][j] && !a[i][j+1])
            fix(arr,b,a,vis,n,m,x,i,j+1);
        if (i > 0 && arr[i-1][j] == arr[i][j] && !a[i-1][j])
            fix(arr,b,a,vis,n,m,x,i-1,j);
        if (j > 0 && arr[i][j-1] == arr[i][j] && !a[i][j-1])
            fix(arr,b,a,vis,n,m,x,i,j-1);
        if (val != arr[i][j]) vis[i][j] = true;
        b[i][j] = val;
    }
    private static boolean fixit (int [][] arr ,boolean [][] a , int n , int m , int val , int i , int j) {
        a[i][j] = true;
        boolean ok = true;
        int x ;
        if (val == arr[i][j]) x = val + 1;
        else x = val - 1;
        if (i+1 < n && arr[i+1][j] == arr[i][j] && !a[i+1][j])
            ok = fixit(arr,a,n,m,x,i+1,j);
        if (j+1 < m && arr[i][j+1] == arr[i][j] && !a[i][j+1])
            ok = (ok & fixit(arr,a,n,m,x,i,j+1));
        if (i > 0 && arr[i-1][j] == arr[i][j] && !a[i-1][j])
            ok = (ok & fixit(arr,a,n,m,x,i-1,j));
        if (j > 0 && arr[i][j-1] == arr[i][j] && !a[i][j-1])
            ok = (ok & fixit(arr,a,n,m,x,i,j-1));
        if (i+1 < n && arr[i+1][j] == val && arr[i][j] != val)
            ok = false;
        if (j+1 < m && arr[i][j+1] == val && arr[i][j] != val)
            ok = false;
        if (i > 0 && arr[i-1][j] == val && arr[i][j] != val)
            ok = false;
        if (j > 0 && arr[i][j-1] == val && arr[i][j] != val)
            ok = false;
        return ok;
    }
    public static void shuffle(long[] arr) {
        int n = arr.length;
        Random rand = new Random();
        for (int i = 0; i < n; i++) {
            long temp = arr[i];
            int randomPos = i + rand.nextInt(n - i);
            arr[i] = arr[randomPos];
            arr[randomPos] = temp;
        }
    }

    public static long nCr(long[] fact, long[] inv, int n, int r, long mod) {
        if (n < r)
            return 0;
        return ((fact[n] * inv[n - r]) % mod * inv[r]) % mod;
    }

    private static void factorials(long[] fact, long[] inv, long mod, int n) {
        fact[0] = 1;
        inv[0] = 1;
        for (int i = 1; i <= n; ++i) {
            fact[i] = (fact[i - 1] * i) % mod;
            inv[i] = power(fact[i], mod - 2, mod);
        }
    }

    private static long power(long a, long n, long p) {
        long result = 1;
        while (n > 0) {
            if (n % 2 == 0) {
                a = (a * a) % p;
                n /= 2;
            } else {
                result = (result * a) % p;
                n--;
            }
        }
        return result;
    }

    private static long power(long a, long n) {
        long result = 1;
        while (n > 0) {
            if (n % 2 == 0) {
                a = (a * a);
                n /= 2;
            } else {
                result = (result * a);
                n--;
            }
        }
        return result;
    }

    private static long query(long[] tree, int in, int start, int end, int l, int r) {
        if (start >= l && r >= end) return tree[in];
        if (end < l || start > r) return 0;
        int mid = (start + end) / 2;
        long x = query(tree, 2 * in, start, mid, l, r);
        long y = query(tree, 2 * in + 1, mid + 1, end, l, r);
        return x + y;
    }

    private static void update(int[] arr, long[] tree, int in, int start, int end, int idx, int val) {
        if (start == end) {
            tree[in] = val;
            arr[idx] = val;
            return;
        }
        int mid = (start + end) / 2;
        if (idx > mid) update(arr, tree, 2 * in + 1, mid + 1, end, idx, val);
        else update(arr, tree, 2 * in, start, mid, idx, val);
        tree[in] = tree[2 * in] + tree[2 * in + 1];
    }

    private static void build(int[] arr, long[] tree, int in, int start, int end) {
        if (start == end) {
            tree[in] = arr[start];
            return;
        }
        int mid = (start + end) / 2;
        build(arr, tree, 2 * in, start, mid);
        build(arr, tree, 2 * in + 1, mid + 1, end);
        tree[in] = (tree[2 * in + 1] + tree[2 * in]);
    }

    static class Reader {
        private InputStream mIs;
        private byte[] buf = new byte[1024];
        private int curChar, numChars;

        public Reader() {
            this(System.in);
        }

        public Reader(InputStream is) {
            mIs = is;
        }

        public int read() {
            if (numChars == -1) throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = mIs.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            int c = read();
            while (isSpaceChar(c)) c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public String s() {
            int c = read();
            while (isSpaceChar(c)) c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public long l() {
            int c = read();
            while (isSpaceChar(c)) c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int i() {
            int c = read();
            while (isSpaceChar(c)) c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public double d() throws IOException {
            return Double.parseDouble(s());
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

        public int[] arr(int n) {
            int[] ret = new int[n];
            for (int i = 0; i < n; i++) {
                ret[i] = i();
            }
            return ret;
        }

        public long[] arrLong(int n) {
            long[] ret = new long[n];
            for (int i = 0; i < n; i++) {
                ret[i] = l();
            }
            return ret;
        }
    }
//    static class pairLong implements Comparator<pairLong> {
//        long first, second;
//
//        pairLong() {
//        }
//
//        pairLong(long first, long second) {
//            this.first = first;
//            this.second = second;
//        }
//
//        @Override
//        public int compare(pairLong p1, pairLong p2) {
//            if (p1.first == p2.first) {
//                if(p1.second > p2.second) return 1;
//                else return -1;
//            }
//            if(p1.first > p2.first) return 1;
//            else return -1;
//        }
//    }
//    static class pair implements Comparator<pair> {
//        int first, second;
//
//        pair() {
//        }
//
//        pair(int first, int second) {
//            this.first = first;
//            this.second = second;
//        }
//
//        @Override
//        public int compare(pair p1, pair p2) {
//            if (p1.first == p2.first) return p1.second - p2.second;
//            return p1.first - p2.first;
//        }
//    }
}

