#include<iostream>
using namespace std;

int main(){
  bool grid[100][100];
  int t,n;

  cin >> t;

  while(t--){
    cin >> n;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++)grid[i][j] = false;
    }

    bool f[4];
    for(int i=0;i<4;i++)f[i] = true;
    int x = 0, y = n-1;
    grid[y][x] = true;

    while(f[0] || f[1] || f[2] || f[3]){
      for(int i=0;i<4;i++)f[i] = false;

      while(1){
	y--;
	if(y < 0 || (x+1 < n && grid[y][x+1]) || (x-1 >= 0 && grid[y][x-1]) || (y-1 >= 0 && grid[y-1][x]) ){
	  y++;
	  break;
	}
	f[0] = true;
	grid[y][x] = true;
      }

     while(1){
	x++;
	if(x >= n || (y+1 < n && grid[y+1][x]) || (y-1 >= 0 && grid[y-1][x]) || (x+1 < n && grid[y][x+1]) ){
	  x--;
	  break;
	}
	f[1] = true;
	grid[y][x] = true;
      }
  
     while(1){
	y++;
	if(y >= n ||(x-1 >= 0 && grid[y][x-1]) || (x+1 < n && grid[y][x+1]) || (y+1 < n && grid[y+1][x]) ){
	  y--;
	  break;
	}
	f[2] = true;
	grid[y][x] = true;
      }

      while(1){
	x--;
	if(x < 0 || (y+1 < n && grid[y+1][x]) || (y-1 >= 0 && grid[y-1][x]) || (x-1 >= 0 && grid[y][x-1]) ){
	  x++;
	  break;
	}
	f[3] = true;
	grid[y][x] = true;
      }
    }
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	if(grid[i][j])cout << "#";
	else cout << " ";
      }
      cout << endl;
    }
    if(t)cout << endl;
  }
}
### Prompt

Your challenge is to write a cpp solution to the following problem:

I decided to create a program that displays a "round and round pattern". The "round and round pattern" is as follows.

* If the length of one side is n, it is displayed as a character string with n rows and n columns.
* A spiral pattern that rotates clockwise with the lower left corner as the base point.
* The part with a line is represented by # (half-width sharp), and the blank part is represented by "" (half-width blank).
* Leave a space between the lines.



Create a program that takes an integer n as an input and outputs a "round and round pattern" with a side length of n.



Input

The input is given in the following format:


d
n1
n2
::
nd


The number of datasets d (d ≤ 20) is given to the first line, and the side length ni (1 ≤ ni ≤ 100) of the i-th round pattern is given to each of the following d lines.

Output

Please output a round and round pattern for each data set. Insert a blank line between the datasets.

Example

Input

2
5
6


Output

#####
#   #
# # #
# # #
# ###

######
#    #
# ## #
# #  #
# #  #
# ####

### Response

```cpp
#include<iostream>
using namespace std;

int main(){
  bool grid[100][100];
  int t,n;

  cin >> t;

  while(t--){
    cin >> n;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++)grid[i][j] = false;
    }

    bool f[4];
    for(int i=0;i<4;i++)f[i] = true;
    int x = 0, y = n-1;
    grid[y][x] = true;

    while(f[0] || f[1] || f[2] || f[3]){
      for(int i=0;i<4;i++)f[i] = false;

      while(1){
	y--;
	if(y < 0 || (x+1 < n && grid[y][x+1]) || (x-1 >= 0 && grid[y][x-1]) || (y-1 >= 0 && grid[y-1][x]) ){
	  y++;
	  break;
	}
	f[0] = true;
	grid[y][x] = true;
      }

     while(1){
	x++;
	if(x >= n || (y+1 < n && grid[y+1][x]) || (y-1 >= 0 && grid[y-1][x]) || (x+1 < n && grid[y][x+1]) ){
	  x--;
	  break;
	}
	f[1] = true;
	grid[y][x] = true;
      }
  
     while(1){
	y++;
	if(y >= n ||(x-1 >= 0 && grid[y][x-1]) || (x+1 < n && grid[y][x+1]) || (y+1 < n && grid[y+1][x]) ){
	  y--;
	  break;
	}
	f[2] = true;
	grid[y][x] = true;
      }

      while(1){
	x--;
	if(x < 0 || (y+1 < n && grid[y+1][x]) || (y-1 >= 0 && grid[y-1][x]) || (x-1 >= 0 && grid[y][x-1]) ){
	  x++;
	  break;
	}
	f[3] = true;
	grid[y][x] = true;
      }
    }
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	if(grid[i][j])cout << "#";
	else cout << " ";
      }
      cout << endl;
    }
    if(t)cout << endl;
  }
}
```