#include<bits/stdc++.h>
#define N 100
using namespace std;

int t,n,y,x,d,f;
char c[N][N];
int dy[4]={1,0,-1,0};
int dx[4]={0,1,0,-1};

bool check(int a,int b){
  return (a>=0&&b>=0&&a<n&&b<n);
}

int main(){
  cin>>t;
  while(t--){
    cin>>n;
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++)c[i][j]=' ';
    y=x=d=0;
    c[y][x]='#';
    while(1){
      int ny=y+dy[d];
      int nx=x+dx[d];
      f=0;
      if(ny<0||nx<0||n<=ny||n<=nx)f=1;
      int a=ny+dy[d],b=nx+dx[d];
      if(check(a,b)&&c[a][b]=='#')f=1;
      if(f)d=(d+1)%4;
      ny=y+dy[d];
      nx=x+dx[d];
      a=ny+dy[d],b=nx+dx[d];
      if(check(a,b)&&c[a][b]=='#')break;
      a=ny+dy[(d+1)%4],b=nx+dx[(d+1)%4];
      if(check(a,b)&&c[a][b]=='#')break;
      y+=dy[d];
      x+=dx[d];
      c[y][x]='#';
    }
    for(int i=n-1;i>=0;i--){
      for(int j=0;j<n;j++)cout<<c[i][j];
      cout<<endl;
    }
    if(t)cout<<endl;
  }
  return 0;
}
### Prompt

In CPP, your task is to solve 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<bits/stdc++.h>
#define N 100
using namespace std;

int t,n,y,x,d,f;
char c[N][N];
int dy[4]={1,0,-1,0};
int dx[4]={0,1,0,-1};

bool check(int a,int b){
  return (a>=0&&b>=0&&a<n&&b<n);
}

int main(){
  cin>>t;
  while(t--){
    cin>>n;
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++)c[i][j]=' ';
    y=x=d=0;
    c[y][x]='#';
    while(1){
      int ny=y+dy[d];
      int nx=x+dx[d];
      f=0;
      if(ny<0||nx<0||n<=ny||n<=nx)f=1;
      int a=ny+dy[d],b=nx+dx[d];
      if(check(a,b)&&c[a][b]=='#')f=1;
      if(f)d=(d+1)%4;
      ny=y+dy[d];
      nx=x+dx[d];
      a=ny+dy[d],b=nx+dx[d];
      if(check(a,b)&&c[a][b]=='#')break;
      a=ny+dy[(d+1)%4],b=nx+dx[(d+1)%4];
      if(check(a,b)&&c[a][b]=='#')break;
      y+=dy[d];
      x+=dx[d];
      c[y][x]='#';
    }
    for(int i=n-1;i>=0;i--){
      for(int j=0;j<n;j++)cout<<c[i][j];
      cout<<endl;
    }
    if(t)cout<<endl;
  }
  return 0;
}
```