#include <iostream>
#include <algorithm>

using namespace std;

int main() {
  int Tc; cin >> Tc;
  bool a = 0;
  while(Tc--) {
    int N; cin >> N;
    if(a) cout << endl;
    a = 1;
    
    char grid[N+2][N+2];
    for(int i=0; i<N; i++) {
      fill(grid[i], grid[i]+N, ' ');
      grid[i][N] = '\0';
    }

    const int dx[] = {0,1,0,-1};
    const int dy[] = {-1,0,1,0};
    
    int x = 0, y = N;
    int n = N;
    for(int i=0; i<N; i++) {
      for(int l=0; l<n; l++) {
	y += dy[i%4], x += dx[i%4];
	grid[y][x] = '#';
      }
      if(i%2 == 0 && i>=2) n -= 2;
      if(i%4 == 0) x --;
      if(i%4 == 1) y --;
      if(i%4 == 2) x ++;
      if(i%4 == 3) y ++;
    }
    
    for(int i=0; i<N; i++) {
      cout << grid[i] << endl;
    }
  }
  
  return 0;
}
### Prompt

Your task is to create 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;

int main() {
  int Tc; cin >> Tc;
  bool a = 0;
  while(Tc--) {
    int N; cin >> N;
    if(a) cout << endl;
    a = 1;
    
    char grid[N+2][N+2];
    for(int i=0; i<N; i++) {
      fill(grid[i], grid[i]+N, ' ');
      grid[i][N] = '\0';
    }

    const int dx[] = {0,1,0,-1};
    const int dy[] = {-1,0,1,0};
    
    int x = 0, y = N;
    int n = N;
    for(int i=0; i<N; i++) {
      for(int l=0; l<n; l++) {
	y += dy[i%4], x += dx[i%4];
	grid[y][x] = '#';
      }
      if(i%2 == 0 && i>=2) n -= 2;
      if(i%4 == 0) x --;
      if(i%4 == 1) y --;
      if(i%4 == 2) x ++;
      if(i%4 == 3) y ++;
    }
    
    for(int i=0; i<N; i++) {
      cout << grid[i] << endl;
    }
  }
  
  return 0;
}
```