#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <complex>
#include <string>

using namespace std;

#define loop(i,a,b) for(int i=a; i<int(b); i++)
#define rep(i,b) loop(i,0,b)

double const pi = acos(-1);
typedef complex<int> P;
char a[128][128];
int n;

void solve(){
    rep(i,n+4){
        rep(j,n+4){
            if(i*j==0 || (n+3-i)*(n+3-j)==0)a[i][j]='#';
            else a[i][j]=' ';
        }
        a[i][n+4]='\0';
    }

    P d(-1,0), p(n+1,2);
    while(1){
        a[p.real()][p.imag()]='#';
        int y=p.real(), x=p.imag();
        if(a[y+2*d.real()][x+2*d.imag()]=='#')d/=P(0,1);
        if(a[y+2*d.real()][x+2*d.imag()]=='#')break;
        p+=d;
        int c=0;
        rep(i,4){
            int ny=(p+d).real(), nx=(p+d).imag();
            if(a[ny][nx]=='#')c++;
            d*=P(0,1);
        }
        if(c>1)break;
    }
}

int main(){
    int d;cin>>d;
    rep(x,d){
        cin>>n;
        solve();
        rep(i,n){
            rep(j,n)cout<<a[i+2][j+2];
            cout<<endl;
        }
        if(x+1!=d)cout<<endl;
    }
}
### 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
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <complex>
#include <string>

using namespace std;

#define loop(i,a,b) for(int i=a; i<int(b); i++)
#define rep(i,b) loop(i,0,b)

double const pi = acos(-1);
typedef complex<int> P;
char a[128][128];
int n;

void solve(){
    rep(i,n+4){
        rep(j,n+4){
            if(i*j==0 || (n+3-i)*(n+3-j)==0)a[i][j]='#';
            else a[i][j]=' ';
        }
        a[i][n+4]='\0';
    }

    P d(-1,0), p(n+1,2);
    while(1){
        a[p.real()][p.imag()]='#';
        int y=p.real(), x=p.imag();
        if(a[y+2*d.real()][x+2*d.imag()]=='#')d/=P(0,1);
        if(a[y+2*d.real()][x+2*d.imag()]=='#')break;
        p+=d;
        int c=0;
        rep(i,4){
            int ny=(p+d).real(), nx=(p+d).imag();
            if(a[ny][nx]=='#')c++;
            d*=P(0,1);
        }
        if(c>1)break;
    }
}

int main(){
    int d;cin>>d;
    rep(x,d){
        cin>>n;
        solve();
        rep(i,n){
            rep(j,n)cout<<a[i+2][j+2];
            cout<<endl;
        }
        if(x+1!=d)cout<<endl;
    }
}
```