#include <iostream>
#include <algorithm>
using namespace std;

const int di[] = {0,1,0,-1};
const int dj[] = {1,0,-1,0};
string g[102][100];

void init() {
  g[1][0] = "#";
  g[2][0] = "##";
  g[2][1] = "# ";
  for(int k = 3; k <= 100; ++k) {
    for(int i = 0; i < k-2; ++i) {
      g[k][i] = g[k-2][i];
    }
    for(int i = 0; i < k-2; ++i) {
      g[k][i] += " #";
    }
    g[k][k-2] = string(k, ' ');
    g[k][k-2][0] = g[k][k-2][k-1] = '#';
    g[k][k-1] = string(k, '#');
    for(int i = 0; i < k; ++i) {
      for(int j = 0; j < k; ++j) {
        if(make_pair(i,j) < make_pair(k-i-1,k-j-1)) {
          swap(g[k][i][j], g[k][k-i-1][k-j-1]);
        }
      }
    }
  }
}

int main() {
  init();
  int d;
  cin >> d;
  for(int tc = 0; tc < d; ++tc) {
    int n;
    cin >> n;
    if(tc) cout << endl;
    for(int i = 0; i < n; ++i) {
      cout << g[n][i] << endl;
    }
  }
  return 0;
}
### Prompt

Generate 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 <algorithm>
using namespace std;

const int di[] = {0,1,0,-1};
const int dj[] = {1,0,-1,0};
string g[102][100];

void init() {
  g[1][0] = "#";
  g[2][0] = "##";
  g[2][1] = "# ";
  for(int k = 3; k <= 100; ++k) {
    for(int i = 0; i < k-2; ++i) {
      g[k][i] = g[k-2][i];
    }
    for(int i = 0; i < k-2; ++i) {
      g[k][i] += " #";
    }
    g[k][k-2] = string(k, ' ');
    g[k][k-2][0] = g[k][k-2][k-1] = '#';
    g[k][k-1] = string(k, '#');
    for(int i = 0; i < k; ++i) {
      for(int j = 0; j < k; ++j) {
        if(make_pair(i,j) < make_pair(k-i-1,k-j-1)) {
          swap(g[k][i][j], g[k][k-i-1][k-j-1]);
        }
      }
    }
  }
}

int main() {
  init();
  int d;
  cin >> d;
  for(int tc = 0; tc < d; ++tc) {
    int n;
    cin >> n;
    if(tc) cout << endl;
    for(int i = 0; i < n; ++i) {
      cout << g[n][i] << endl;
    }
  }
  return 0;
}
```