You are given an m x n grid containing an integer in each cell. You have a software that sends rays thorough each diagonal and calculates the sum of all the diagonals. The software sends the rays in two phases, in first phase; it sends n + m - 1 rays as in fig 1, in second phase; it sends n + m - 1 rays as in fig 2. When a ray completes its cells, it calculates the summation of the integers in the cells it has visited. For example, you are given a 7 x 6 grid. Then the rays are:
Fig 1: order of the rays in first phase Fig 2: order of the rays in second phase
Each of the integers in the cells lies in the range [1, 100]. Now you are given the summation found by the rays in both phases, your task is to generate the grid.
Input starts with an integer T (≤ 50), denoting the number of test cases.
Each case starts with a line containing two integers: m and n (1 ≤ m, n ≤ 50). The next line contains n + m - 1 integers (space separated) denoting the summation found by the rays in phase 1. The next line contains n + m - 1 integers (space separated) denoting the summation found by the rays in phase 2. You can assume that these values are generated from a board which follows the restrictions described above.
For each case, print the case number in a line. Then print the grid using the following format. Print m lines, each containing n integers, and two consecutive integers should be separated by a single space. Since there can be many solutions, print any valid one.
Output for Sample Input
2 8 11 5
9 12 4 1
2 7 9
1 2 5
This is a special judge problem; wrong output format may cause 'wrong answer'.