#include<iostream>
using namespace std;
bool vis[110][110],na[110][110];
int dx[]={0,1,0,-1},dy[]={-1,0,1,0};
int ex[]={-1,1,0,0},ey[]={0,0,-1,1};
int n;
void DFS(int y,int x,int k){
  vis[y][x]=true;
  na[y][x]=true;
  int xx,yy;
  bool done=false;
  for(int i=0;i<4;i++){
    xx=x+dx[k],yy=y+dy[k];
    bool ok=false;
    if(0<=xx&&xx<n&&0<=yy&&yy<n){
      if(na[yy][xx]==false){
	ok=true;
      }
    }
    if(ok){done=true;break;}
    k=(k+1)%4;
  }
  if(!done)return;
  for(int i=0;i<2;i++){
    int r=i+(k%2)*2;
    int nx=x+ex[r],ny=y+ey[r];
    if(0<=nx&&nx<n&&0<=ny&&ny<n){
      na[ny][nx]=true;
    }
  }
  DFS(yy,xx,k);
}
int main(){
  int q;cin>>q;
  for(int u=0;u<q;u++){
    if(u)cout<<endl;
    cin>>n;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	vis[i][j]=false;
	na[i][j]=false;
      }
    }
    DFS(n-1,0,0);
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++)cout<<(vis[i][j]?"#":" ");
      cout<<endl;
    }
  }
  return 0;
}
### Prompt

Construct a CPP code solution to the problem outlined:

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;
bool vis[110][110],na[110][110];
int dx[]={0,1,0,-1},dy[]={-1,0,1,0};
int ex[]={-1,1,0,0},ey[]={0,0,-1,1};
int n;
void DFS(int y,int x,int k){
  vis[y][x]=true;
  na[y][x]=true;
  int xx,yy;
  bool done=false;
  for(int i=0;i<4;i++){
    xx=x+dx[k],yy=y+dy[k];
    bool ok=false;
    if(0<=xx&&xx<n&&0<=yy&&yy<n){
      if(na[yy][xx]==false){
	ok=true;
      }
    }
    if(ok){done=true;break;}
    k=(k+1)%4;
  }
  if(!done)return;
  for(int i=0;i<2;i++){
    int r=i+(k%2)*2;
    int nx=x+ex[r],ny=y+ey[r];
    if(0<=nx&&nx<n&&0<=ny&&ny<n){
      na[ny][nx]=true;
    }
  }
  DFS(yy,xx,k);
}
int main(){
  int q;cin>>q;
  for(int u=0;u<q;u++){
    if(u)cout<<endl;
    cin>>n;
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	vis[i][j]=false;
	na[i][j]=false;
      }
    }
    DFS(n-1,0,0);
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++)cout<<(vis[i][j]?"#":" ");
      cout<<endl;
    }
  }
  return 0;
}
```