#include<iostream>

using namespace std;

int main()
{
  int d;
  cin>>d;
  for(;d--;)
    {
      int n;
      cin>>n;
      char output[n][n];
      for(int i=0;i<n;i++)
	for(int j=0;j<n;j++)
	  output[i][j]=' ';

      int dx[]={-1,0,1,0};
      int dy[]={0,1,0,-1};
      int move=0;
      int cnt=0;
      int x=n-1,y=0;
      for(;;)
	{
	  //	  cout<<x<<" "<<y<<endl;
	  // cout<<"next:"<<x+dx[move]<<" "<<y+dy[move]<<endl;
	  output[x][y]='#';
	  cnt++;
	  bool flag=false;
	  while(x+dx[move]<0 || 
		x+dx[move]>=n ||
		y+dy[move]<0 || 
		y+dy[move]>=n ||
		(
		 x+dx[move]*2>=0 &&
		 x+dx[move]*2<n &&
		 y+dy[move]*2>=0 &&
		 y+dy[move]*2<n &&
		 output[x+dx[move]*2][y+dy[move]*2]=='#'
		 )
		)
	    {
	      /*
		cout<<(x+dx[move]<0)<<endl; 
		cout<<(x+dx[move]>=n)<<endl; 
		cout<<(y+dy[move]<0)<<endl; 
		cout<<(y+dy[move]>=n)<<endl; 
	      */
	      move++;
	      if(move>3)
		move=0;
	      
	      if(cnt<2)
		{
		  flag=true;
		  break;
		}
	      cnt=0;
	    }
	  if(flag)
	    break;
	  x+=dx[move];
	  y+=dy[move];
	  
	}

      for(int i=0;i<n;i++,cout<<endl)
	for(int j=0;j<n;j++)
	  cout<<output[i][j];
      if(d>0)
	cout<<endl;
    }

}
### Prompt

Develop a solution in CPP to the problem described below:

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()
{
  int d;
  cin>>d;
  for(;d--;)
    {
      int n;
      cin>>n;
      char output[n][n];
      for(int i=0;i<n;i++)
	for(int j=0;j<n;j++)
	  output[i][j]=' ';

      int dx[]={-1,0,1,0};
      int dy[]={0,1,0,-1};
      int move=0;
      int cnt=0;
      int x=n-1,y=0;
      for(;;)
	{
	  //	  cout<<x<<" "<<y<<endl;
	  // cout<<"next:"<<x+dx[move]<<" "<<y+dy[move]<<endl;
	  output[x][y]='#';
	  cnt++;
	  bool flag=false;
	  while(x+dx[move]<0 || 
		x+dx[move]>=n ||
		y+dy[move]<0 || 
		y+dy[move]>=n ||
		(
		 x+dx[move]*2>=0 &&
		 x+dx[move]*2<n &&
		 y+dy[move]*2>=0 &&
		 y+dy[move]*2<n &&
		 output[x+dx[move]*2][y+dy[move]*2]=='#'
		 )
		)
	    {
	      /*
		cout<<(x+dx[move]<0)<<endl; 
		cout<<(x+dx[move]>=n)<<endl; 
		cout<<(y+dy[move]<0)<<endl; 
		cout<<(y+dy[move]>=n)<<endl; 
	      */
	      move++;
	      if(move>3)
		move=0;
	      
	      if(cnt<2)
		{
		  flag=true;
		  break;
		}
	      cnt=0;
	    }
	  if(flag)
	    break;
	  x+=dx[move];
	  y+=dy[move];
	  
	}

      for(int i=0;i<n;i++,cout<<endl)
	for(int j=0;j<n;j++)
	  cout<<output[i][j];
      if(d>0)
	cout<<endl;
    }

}
```