#include<iostream>
#include<queue>
#include<map>
#include<cstring>
using namespace std;
#define fr first
#define sc second
#define INF 100
typedef pair<int,int>Pt;
int main(){
  int d,n,dx[]={-1,0,1,0},dy[]={0,1,0,-1};
  char mas[101][101]; //上右下左
  bool ok = false;
  cin >> d;
  while(d--){
    if(ok) cout << endl;
    memset(mas,' ',sizeof(mas));
    cin >> n;
    for(int i=0,x=n-1,MUKI=0,y=0;i<n;i++,x+=dx[MUKI],y+=dy[MUKI]) mas[x][y] = '#';
    for(int i=0,cnt=n,x=0,y=0,MUKI=1;i<n-1;i++,MUKI=(MUKI+1)%4){
      for(int j=0;j<cnt;j++,x+=dx[MUKI],y+=dy[MUKI]) mas[x][y] = '#';
      x-=dx[MUKI],y-=dy[MUKI];
      if(i%2==1)cnt-=2;
    }
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++) cout << mas[i][j];
      cout << endl;
    }
    ok = true;
  }
}
### 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>
#include<queue>
#include<map>
#include<cstring>
using namespace std;
#define fr first
#define sc second
#define INF 100
typedef pair<int,int>Pt;
int main(){
  int d,n,dx[]={-1,0,1,0},dy[]={0,1,0,-1};
  char mas[101][101]; //上右下左
  bool ok = false;
  cin >> d;
  while(d--){
    if(ok) cout << endl;
    memset(mas,' ',sizeof(mas));
    cin >> n;
    for(int i=0,x=n-1,MUKI=0,y=0;i<n;i++,x+=dx[MUKI],y+=dy[MUKI]) mas[x][y] = '#';
    for(int i=0,cnt=n,x=0,y=0,MUKI=1;i<n-1;i++,MUKI=(MUKI+1)%4){
      for(int j=0;j<cnt;j++,x+=dx[MUKI],y+=dy[MUKI]) mas[x][y] = '#';
      x-=dx[MUKI],y-=dy[MUKI];
      if(i%2==1)cnt-=2;
    }
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++) cout << mas[i][j];
      cout << endl;
    }
    ok = true;
  }
}
```