#include <iostream>
#include <cstring>
using namespace std;
char buf[150][150];
int dx[4]={-1,0,1,0};
int dy[4]={0,1,0,-1};
bool check(int tx,int ty)
{
    if(tx<0||ty<0)return false;
    return buf[tx][ty]=='#';
}
void solve(int x)
{
    memset(buf,' ',sizeof(buf));
    for(int i=1;i<=x;i++)
    {
        for(int j=1;j<=x;j++)
        {
            buf[i][j]='#';
        }
    }
    int X=x,Y=2;
    int cnt=0;
    for(int p=0;p<=10000;p++)
    {
        if(X>x+10||Y>x+10||X<0||Y<0)break;
        if(x%4==1&&X==(x+3)/2&&Y==(x+1)/2)break;
        if(x%4==3&&X==(x+1)/2&&Y==(x+3)/2)break;
        buf[X][Y]=' ';
        X+=dx[cnt];Y+=dy[cnt];
        if(check(X+dx[cnt],Y+dy[cnt])&&!check(X+dx[cnt]*2,Y+dy[cnt]*2))
        {
            cnt++;
            cnt%=4;
        }
    }
    for(int i=1;i<=x;i++)
    {
        for(int j=1;j<=x;j++)
        {
            cout << buf[i][j];
        }
        cout << endl;
    }
    return;
}
int main()
{
    int q;
    cin >> q;
    for(int i=0;i<q;i++)
    {
        int k;
        cin >> k;
		if(k==2)
		{
			cout << "##" << endl;
			cout << "# " << endl;
		}
        else solve(k);
		if(i!=q-1)cout << endl;
    }
    return 0;
}
### Prompt

Please create a solution in cpp 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 <cstring>
using namespace std;
char buf[150][150];
int dx[4]={-1,0,1,0};
int dy[4]={0,1,0,-1};
bool check(int tx,int ty)
{
    if(tx<0||ty<0)return false;
    return buf[tx][ty]=='#';
}
void solve(int x)
{
    memset(buf,' ',sizeof(buf));
    for(int i=1;i<=x;i++)
    {
        for(int j=1;j<=x;j++)
        {
            buf[i][j]='#';
        }
    }
    int X=x,Y=2;
    int cnt=0;
    for(int p=0;p<=10000;p++)
    {
        if(X>x+10||Y>x+10||X<0||Y<0)break;
        if(x%4==1&&X==(x+3)/2&&Y==(x+1)/2)break;
        if(x%4==3&&X==(x+1)/2&&Y==(x+3)/2)break;
        buf[X][Y]=' ';
        X+=dx[cnt];Y+=dy[cnt];
        if(check(X+dx[cnt],Y+dy[cnt])&&!check(X+dx[cnt]*2,Y+dy[cnt]*2))
        {
            cnt++;
            cnt%=4;
        }
    }
    for(int i=1;i<=x;i++)
    {
        for(int j=1;j<=x;j++)
        {
            cout << buf[i][j];
        }
        cout << endl;
    }
    return;
}
int main()
{
    int q;
    cin >> q;
    for(int i=0;i<q;i++)
    {
        int k;
        cin >> k;
		if(k==2)
		{
			cout << "##" << endl;
			cout << "# " << endl;
		}
        else solve(k);
		if(i!=q-1)cout << endl;
    }
    return 0;
}
```