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.io.*;
import java.util.*;

public class Main {
    static PrintWriter pw;
    static Scanner sc;
    static long ceildiv(long x, long y) { return (x+y-1)/y; }
    static int mod(long x, int m) { return (int)((x%m+m)%m); }
    static void put(TreeMap<Long, Integer> map, long p){if(map.containsKey(p)) map.replace(p, map.get(p)+1); else map.put(p, 1); }
    static void rem(TreeMap<Long, Integer> map, long p){ if(map.get(p)==1) map.remove(p);else map.replace(p, map.get(p)-1); }
    static void printf(double x, int dig){ String s="%."+dig+"f"; pw.printf(s, x); }
    static int Int(boolean x){ return x?1:0; }
    static final int inf=(int)1e9, mod=inf+7;
    static final long infL=inf*1l*inf;
    static final double r2=Math.sqrt(2), eps=1e-9;
    static ArrayList<Integer>[] adj;
    static long[] arr, fact;
    static int[][] ans;
    static boolean[][] plus;
    static int[][][][] dp;
    public static long gcd(long x, long y) { return y==0? x: gcd(y, x%y); }
    public static void main(String[] args) throws IOException {
        sc=new Scanner(System.in);
        pw=new PrintWriter(System.out);
        int t=sc.nextInt();
        while(t-->0){
            int n=sc.nextInt(), m=sc.nextInt(), arr[][]=new int[n][];
            for(int i=0; i<n; i++)
                arr[i]=sc.nextArr(m);
            dp=new int[n][m][2][2];
            for(int i=0; i<n; i++){
                for(int j=0; j<m; j++){
                    for(int k=0; k<2; k++)
                        Arrays.fill(dp[i][j][k], -1);
                }
            }
            plus=new boolean[n][m];
            solve(arr, 0, 0);
            ans=new int[n][m];
            trace(arr,0, 0);
            for(int i=0; i<n; i++)
                printArr(ans[i]);
        }
        pw.close();
    }
    static boolean solve(int[][] arr, int i, int j){
        if(i==arr.length)
            return true;
        if(j==arr[i].length)
            return solve(arr, i+1, 0);
        int up=i==0?-1:arr[i-1][j]+Int(plus[i-1][j]), left=j==0?-1:arr[i][j-1]+Int(plus[i][j-1]);
        boolean done=false;
        if(dp[i][j][Int(i>0 && plus[i-1][j])][Int(j>0 && plus[i][j-1])]==-1){
            if(arr[i][j]!=up && arr[i][j]!=left){
                plus[i][j]=false;
                if(solve(arr, i, j+1)){
                    dp[i][j][Int(i>0 && plus[i-1][j])][Int(j>0 && plus[i][j-1])]=arr[i][j];
                    done=true;
                }
            }if(!done && arr[i][j]+1!=up && arr[i][j]+1!=left){
                plus[i][j]=true;
                if(solve(arr, i, j+1))
                    dp[i][j][Int(i>0 && plus[i-1][j])][Int(j>0 && plus[i][j-1])]=arr[i][j]+1;
                else
                    dp[i][j][Int(i>0 && plus[i-1][j])][Int(j>0 && plus[i][j-1])]=0;
                done=true;
            }if(!done){
                dp[i][j][Int(i>0 && plus[i-1][j])][Int(j>0 && plus[i][j-1])]=0;
            }
        }
        return dp[i][j][Int(i>0 && plus[i-1][j])][Int(j>0 && plus[i][j-1])]!=0;
    }
    static void trace(int[][] arr, int i, int j){
        if(i==ans.length)
            return;
        if(j==ans[i].length){
            trace(arr,i+1, 0);
            return;
        }
        ans[i][j]=dp[i][j][Int(i>0 && plus[i-1][j])][Int(j>0 && plus[i][j-1])];
        plus[i][j]=arr[i][j]<ans[i][j];
        trace(arr, i, j+1);
    }
    static void printArr(int[] arr) {
        for (int i = 0; i < arr.length - 1; i++)
            pw.print(arr[i] + " ");
        pw.println(arr[arr.length - 1]);
    }
    static void printArr(long[] arr) {
        for (int i = 0; i < arr.length - 1; i++)
            pw.print(arr[i] + " ");
        pw.println(arr[arr.length - 1]);
    }
    static void printArr(double[] arr) {
        for (int i = 0; i < arr.length - 1; i++)
            pw.print(arr[i] + " ");
        pw.println(arr[arr.length - 1]);
    }
    static void printArr(Integer[] arr) {
        for (int i = 0; i < arr.length; i++)
            pw.print(arr[i] + " ");
        pw.println();
    }
    static void printArr(ArrayList<Integer> list) {
        for (int i = 0; i < list.size(); i++)
            pw.print(list.get(i)+1+" ");
        pw.println();
    }
    static class Scanner {
        StringTokenizer st;
        BufferedReader br;
        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
        public int[] nextDigits() throws IOException{
            String s=nextLine();
            int[] arr=new int[s.length()];
            for(int i=0; i<arr.length; i++)
                arr[i]=s.charAt(i)-'0';
            return arr;
        }
        public int[] nextArr(int n) throws IOException {
            int[] arr = new int[n];
            for (int i = 0; i < arr.length; i++)
                arr[i] = nextInt();
            return arr;
        }
        public Integer[] nextsort(int n) throws IOException{
            Integer[] arr=new Integer[n];
            for(int i=0; i<n; i++)
                arr[i]=nextInt();
            return arr;
        }
        public Pair nextPair() throws IOException{
            return new Pair(nextInt(), nextInt());
        }
        public Pair[] nextPairArr(int n) throws IOException{
            Pair[] arr=new Pair[n];
            for(int i=0; i<n; i++)
                arr[i]=nextPair();
            return arr;
        }
        public boolean ready() throws IOException {
            return br.ready();
        }
    }
    static class Quad{
        int a, b, c, d;
        public Quad(int w, int x, int y, int z){
            a=w;
            b=x;
            c=y;
            d=z;
        }
        public int hashCode(){
            return (int)(a*1e9+b*1e6+c*1e3+d);
        }
        public boolean equals(Object o){
            if(o.getClass()!=this.getClass())
                return false;
            Quad q=(Quad)o;
            return a==q.a && b==q.b && c==q.c && d==q.d;
        }
        public String toString(){
            return a+" "+b+" "+c+" "+d;
        }
    }
    static class Pair implements Comparable<Pair>{
        int x;
        int y;
        public Pair(int x, int y) {
            this.x=x;
            this.y=y;
        }
        public boolean contains(int a){
            return x==a || y==a;
        }
        public int hashCode() {
            return (this.x*1000000000+this.y);
        }
        public int compareTo(Pair p){
            return y-p.y;
        }
        public boolean equals(Object obj) {
            if (obj == null) {
                return false;
            }
            if (this.getClass() != obj.getClass()) {
                return false;
            }
            Pair p = (Pair) obj;
            return this.x==p.x && this.y==p.y;
        }
        public Pair clone(){
            return new Pair(x, y);
        }
        public String toString(){
            return this.x+" "+this.y;
        }
        public void add(Pair p){
            x+=p.x;
            y+=p.y;
        }
    }
    static class LP implements Comparable<LP>{
        long x, y;
        public LP(long a, long b){
            x=a;
            y=b;
        }
        public void add(LP p){
            x+=p.x;
            y+=p.y;
        }
        public boolean equals(LP p){
            return p.x==x && y==p.y;
        }
        public String toString(){
            return this.x+" "+this.y;
        }
        public int compareTo(LP p){
            if(x>p.x)
                return 1;
            if(x<p.x)
                return -1;
            return Long.compare(y, p.y);
        }
    }
    static class Triple implements Comparable<Triple>{
        int x, y, z;
        public Triple(int a, int b, int c){
            x=a;
            y=b;
            z=c;
        }
        public int compareTo(Triple t){
            if(this.y!=t.y)
                return y-t.y;
            return x-t.x;
        }
        public String toString(){
            return x+" "+y+" "+z;
        }
    }
    static class Fenwick{
        long[] tree, arr;
        public Fenwick(long[] a){
            arr=a.clone();
            build();
        }
        public void build(){
            tree=new long[arr.length+1];
            for(int i=0; i<arr.length; i++)
                build(i+1);
        }
        public void build(int i){
            long val=arr[i-1];
            while(i<tree.length){
                tree[i]+=val;
                i+=i&(-i);
            }
        }
        public long query(int i, int j){
            return query(j)-query(i-1);
        }
        public long query(int i){
            if(i==0)
                return 0;
            return tree[i]+query(i-(i&-i));
        }
    }
}