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. 
import java.awt.*;
import java.io.*;
import java.util.*;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;

public class Coding {

    private static BufferedReader bi = new BufferedReader(new InputStreamReader(System.in));
    private static BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) {
        try {
            run();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void run() throws Exception {
        InputModule inp = new InputModule();
        OutputModule out = new OutputModule();
        int t = inp.cinInt();
        while (t > 0) {
            int[] ar = inp.cinIntArray(2);
            int n = ar[0];
            int m = ar[1];
            int[][] mat = new int[n][m];
            int[][] change = new int[n][m];
            for(int i=0;i<n;++i) {
                mat[i] = inp.cinIntArray(m);
            }
            boolean[][][] poss = new boolean[n][m][2];
            Point[][][] pp = new Point[n][m][2];
            for(int i=0;i<n;++i) {
                for(int j=0;j<m;++j) {
                    change[i][j] = 2;
                    poss[i][j][0] = poss[i][j][1] = false;
                    pp[i][j][0] = new Point(-1, -1);
                    pp[i][j][1] = new Point(-1, -1);
                }
            }

            for(int i=0;i<n;++i) {
                for(int j=0;j<m;++j) {
                    // Same value;
                    int curVal = mat[i][j];
                    int lchange = -1;
                    boolean lftPoss = false;
                    if (i-1>=0) {
                        if (mat[i-1][j]!=curVal && poss[i-1][j][0]) {
                            lftPoss = true;
                            lchange = 0;
                        }
                        if (((mat[i-1][j]+1)!=curVal) && poss[i-1][j][1]) {
                            lftPoss = true;
                            lchange = 1;
                        }
                    } else {
                        lftPoss = true;
                    }
                    boolean rghtPoss = false;
                    int rchange = -1;
                    if (j-1>=0) {
                        if (mat[i][j-1]!=curVal && poss[i][j-1][0]) {
                            rghtPoss = true;
                            rchange = 0;
                        }
                        if (((mat[i][j-1]+1)!=curVal) && poss[i][j-1][1]) {
                            rghtPoss = true;
                            rchange = 1;
                        }
                    } else {
                        rghtPoss = true;
                    }
                    if (lftPoss && rghtPoss) {
                        poss[i][j][0] = true;
                        pp[i][j][0].x = lchange;
                        pp[i][j][0].y = rchange;
                    }


                    // Increment
                    curVal = mat[i][j]+1;
                    lchange = -1;
                    lftPoss = false;
                    if (i-1>=0) {
                        if (mat[i-1][j]!=curVal && poss[i-1][j][0]) {
                            lftPoss = true;
                            lchange = 0;
                        }
                        if (((mat[i-1][j]+1)!=curVal) && poss[i-1][j][1]) {
                            lftPoss = true;
                            lchange = 1;
                        }
                    } else {
                        lftPoss = true;
                    }

                    rghtPoss = false;
                    rchange = -1;
                    if (j-1>=0) {
                        if (mat[i][j-1]!=curVal && poss[i][j-1][0]) {
                            rghtPoss = true;
                            rchange = 0;
                        }
                        if (((mat[i][j-1]+1)!=curVal) && poss[i][j-1][1]) {
                            rghtPoss = true;
                            rchange = 1;
                        }
                    } else {
                        rghtPoss = true;
                    }
                    if (lftPoss && rghtPoss) {
                        poss[i][j][1] = true;
                        pp[i][j][1].x = lchange;
                        pp[i][j][1].y = rchange;
                        //System.out.println(i + " " + j + " " + dp[i][j][1].poss + " "  + dp[i][j][1].lft + " " + dp[i][j][1].top);
                    }
                }
            }


            if (poss[n-1][m-1][0]) {
                change[n-1][m-1] = 0;
            } else {
                change[n-1][m-1] = 1;
            }

            for(int i=n-1;i>=0;--i) {
                for(int j=m-1;j>=0;--j) {
                    int curChange = change[i][j];
                    mat[i][j]+=curChange;
                    if (i-1>=0) {
                        change[i-1][j] = Math.min(change[i-1][j], pp[i][j][curChange].x);
                    }
                    if (j-1>=0) {
                        change[i][j-1] = Math.min(change[i][j-1], pp[i][j][curChange].y);
                    }
                }
            }

            out.printIntMatrix(mat, n, m);
            t--;
        }
    }

    private static class Pair {

        int i,j;
        int change;
        public Pair(int i, int j, int change) {
            this.i = i;
            this.j = j;
            this.change = change;
        }
    }

    private static class InputModule {
        private int cinInt() throws Exception {
            return Integer.parseInt(bi.readLine().split(" ")[0].trim());
        }

        private long cinLong() throws Exception {
            return Long.parseLong(bi.readLine().split(" ")[0].trim());
        }

        private Double cinDouble() throws Exception {
            return Double.parseDouble(bi.readLine().split(" ")[0].trim());
        }

        private String cinString() throws Exception {
            return bi.readLine();
        }

        private int[] cinIntArray(int n) throws Exception {
            String input = bi.readLine();
            String[] values = input.split(" ");
            int[] ar = new int[n];
            for (int i = 0; i < n; ++i) {
              ar[i] = Integer.parseInt(values[i]);
            }
            return ar;
        }

        private int[] cinIntArray() throws Exception {
            String input = bi.readLine();
            String[] values = input.split(" ");
            int[] ar = new int[values.length];
            for (int i = 0; i < values.length; ++i) {
                ar[i] = Integer.parseInt(values[i]);
            }
            return ar;
        }

        private long[] cinLongArray(int n) throws Exception {
            String input = bi.readLine();
            String[] values = input.split(" ");
            long[] ar = new long[n];
            for (int i = 0; i < n; ++i) {
                ar[i] = Long.parseLong(values[i]);
            }
            return ar;
        }

        private String[] cinStringArray(int n) throws Exception {
            return bi.readLine().split(" ");
        }
    }

    private static class OutputModule {
        private void printInt(int ans) throws Exception {
            writer.append(ans + "\n");
            writer.flush();
        }

        private void printLong(long ans) throws Exception {
            writer.append(ans + "\n");
            writer.flush();
        }

        private void printDouble(Double ans) throws Exception {
            writer.append(String.format("%.10f", ans));
            writer.append("\n");
            writer.flush();
        }

        private void printString(String ans) throws Exception {
            writer.append(ans + "\n");
            writer.flush();
        }

        private void printIntArray(int[] ans) throws Exception {
            for (int i = 0; i < ans.length; ++i) {
                writer.append(ans[i] + " ");
            }
            writer.append("\n");
            writer.flush();
        }

        private void printLongArray(long[] ans) throws Exception {
            for (int i = 0; i < ans.length; ++i) {
                writer.append(ans[i] + " ");
            }
            writer.append("\n");
            writer.flush();
        }

        private void printIntMatrix(int[][] mat, int n, int m) throws Exception {
            for (int i = 0; i < n; ++i) {
                for (int j = 0; j < m; ++j) {
                    writer.append(mat[i][j] + " ");
                }
                writer.append("\n");
            }
            writer.flush();
        }

        private void printLongMatrix(long[][] mat, int n, int m) throws Exception {
            for (int i = 0; i < n; ++i) {
                for (int j = 0; j < m; ++j) {
                    writer.append(mat[i][j] + " ");
                }
                writer.append("\n");
            }
            writer.flush();
        }

        private void printPoint(Point p) throws Exception {
            writer.append(p.x + " " + p.y + "\n");
            writer.flush();
        }

        private void printPoints(List<Point> p) throws Exception {
            for (Point pp : p) {
                writer.append(pp.x + " " + pp.y + "\n");
            }
            writer.flush();
        }
    }
}