#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
  const int dx[4] = {1,0,-1,0};
  const int dy[4] = {0,1,0,-1};
  int n,d;
  string s;
  for(cin>>n;n>0;n--){
    cin>>d;
    s = "";
    for(int i=0;i<d;i++) s+=" ";
    vector<string> spiral(d);
    for(int i=0;i<d;i++)spiral[i] = s;
    int x=0,y=d-1,dir=2,i=0;
    while(i<=d){
      spiral[y][x] = '#';
      if((i<4&&(y==0||y==d-1)&&(x==0||x==d-1))||(i>3&&spiral[y+2*dy[dir]][x+2*dx[dir]]=='#')){
	dir = (++dir)%4;
	i++;
	if(d==1)break;
      }
      x+=dx[dir];
      y+=dy[dir];
    }
    for(int y=0;y<d;y++)
      cout<<spiral[y]<<endl;
    if(n>1)cout<<endl;
  }
  return 0;
}
### Prompt

Create a solution in Cpp for 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<vector>
#include<string>
using namespace std;
int main(){
  const int dx[4] = {1,0,-1,0};
  const int dy[4] = {0,1,0,-1};
  int n,d;
  string s;
  for(cin>>n;n>0;n--){
    cin>>d;
    s = "";
    for(int i=0;i<d;i++) s+=" ";
    vector<string> spiral(d);
    for(int i=0;i<d;i++)spiral[i] = s;
    int x=0,y=d-1,dir=2,i=0;
    while(i<=d){
      spiral[y][x] = '#';
      if((i<4&&(y==0||y==d-1)&&(x==0||x==d-1))||(i>3&&spiral[y+2*dy[dir]][x+2*dx[dir]]=='#')){
	dir = (++dir)%4;
	i++;
	if(d==1)break;
      }
      x+=dx[dir];
      y+=dy[dir];
    }
    for(int y=0;y<d;y++)
      cout<<spiral[y]<<endl;
    if(n>1)cout<<endl;
  }
  return 0;
}
```