NIKHIL AND MATRICE

3.9

11 votes
Problem

Nikhil got to know about what is a matrice. He made several patterns using 1-d and 2-d matrices. One of which was his favorite pattern. Your task is to right a code for his favorite pattern.

NOTE :- To understand his favorite pattern see the sample output

Input:-

First line of code takes number of test cases 'N' as its input. The following N lines take size 'S' of a sqaure matrice as its input.

Output:-

Print Nikhils favorite pattern and seperate two different test cases with an empty line.

Constraint:-

N<=10

S<=10

Sample Input
1
3
Sample Output
123
894
765
Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?