//01
#include<iostream>
#include<algorithm>

using namespace std;

int n;
char g[100][100];

bool fr(int y,int x,int py,int px){
  bool f=true;
  for(int i=0;i<4;i++){
    int d[]={0,1,0,-1,0};
    int jy=y+d[i];
    int jx=x+d[i+1];
    f&=min(jx,jy)<0||n<=max(jx,jy)||(px==jx&&py==jy)||g[jy][jx]==' ';
  }
  return f;
}

int main(){
  int ds;
  cin>>ds;
  while(ds--){
    cin>>n;
    fill(g[0],g[100],' ');
    g[0][0]='#';
    int d=0,y=0,x=0;
    int p=0;
    for(;;){
      int dx[]={0,1,0,-1};
      int dy[]={1,0,-1,0};
      int ny=y+dy[d];
      int nx=x+dx[d];
      int jy=ny+dy[d];
      int jx=nx+dx[d];
      if(0<=min(nx,ny)&&max(nx,ny)<n&&fr(ny,nx,y,x)){
	y=ny;
	x=nx;
	g[ny][nx]='#';
	p=0;
      }else{
	p++;
	d=(d+1)%4;
	if(p>=2){
	  break;
	}
      }
    }
    for(int y=n-1;y>=0;y--){
      for(int x=0;x<n;x++){
	cout<<g[y][x];
      }
      cout<<endl;
    }
    if(ds){
      cout<<endl;
    }
  }
  return 0;
}
### Prompt

Please provide a cpp coded solution 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
//01
#include<iostream>
#include<algorithm>

using namespace std;

int n;
char g[100][100];

bool fr(int y,int x,int py,int px){
  bool f=true;
  for(int i=0;i<4;i++){
    int d[]={0,1,0,-1,0};
    int jy=y+d[i];
    int jx=x+d[i+1];
    f&=min(jx,jy)<0||n<=max(jx,jy)||(px==jx&&py==jy)||g[jy][jx]==' ';
  }
  return f;
}

int main(){
  int ds;
  cin>>ds;
  while(ds--){
    cin>>n;
    fill(g[0],g[100],' ');
    g[0][0]='#';
    int d=0,y=0,x=0;
    int p=0;
    for(;;){
      int dx[]={0,1,0,-1};
      int dy[]={1,0,-1,0};
      int ny=y+dy[d];
      int nx=x+dx[d];
      int jy=ny+dy[d];
      int jx=nx+dx[d];
      if(0<=min(nx,ny)&&max(nx,ny)<n&&fr(ny,nx,y,x)){
	y=ny;
	x=nx;
	g[ny][nx]='#';
	p=0;
      }else{
	p++;
	d=(d+1)%4;
	if(p>=2){
	  break;
	}
      }
    }
    for(int y=n-1;y>=0;y--){
      for(int x=0;x<n;x++){
	cout<<g[y][x];
      }
      cout<<endl;
    }
    if(ds){
      cout<<endl;
    }
  }
  return 0;
}
```