#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int dy[] = {-1, 0, 1, 0};
    int dx[] = {0, 1, 0, -1};

    int d;
    cin >> d;

    bool first = true;
    while(--d >= 0){
        if(first)
            first = false;
        else
            cout << endl;

        int n;
        cin >> n;

        int len = n-1;
        int num = 3;
        int y = n-1;
        int x = 0;
        int i = 0;
        vector<string> s(n, string(n, ' '));
        s[y][x] = '#';

        for(;;){
            for(int j=0; j<len; ++j){
                y += dy[i];
                x += dx[i];
                s[y][x] = '#';
            }
            (++i) %= 4;
            if(--num == 0){
                num = 2;
                len -= 2;
            }
            if(n % 2 == 0 && num == 1 && len == 1)
                break;
            if(n % 2 == 1 && len == 0)
                break;
        }

        for(int i=0; i<n; ++i)
            cout << s[i] << 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 <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int dy[] = {-1, 0, 1, 0};
    int dx[] = {0, 1, 0, -1};

    int d;
    cin >> d;

    bool first = true;
    while(--d >= 0){
        if(first)
            first = false;
        else
            cout << endl;

        int n;
        cin >> n;

        int len = n-1;
        int num = 3;
        int y = n-1;
        int x = 0;
        int i = 0;
        vector<string> s(n, string(n, ' '));
        s[y][x] = '#';

        for(;;){
            for(int j=0; j<len; ++j){
                y += dy[i];
                x += dx[i];
                s[y][x] = '#';
            }
            (++i) %= 4;
            if(--num == 0){
                num = 2;
                len -= 2;
            }
            if(n % 2 == 0 && num == 1 && len == 1)
                break;
            if(n % 2 == 1 && len == 0)
                break;
        }

        for(int i=0; i<n; ++i)
            cout << s[i] << endl;
    }

    return 0;
}
```