#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int dy[] = {-1, 0, 1, 0};
int dx[] = {0, 1, 0, -1};
int n;
string s[110];

bool is_valid(int y, int x, int d) {
  if (y < 0 || y >= n || x < 0 || x >= n) return false;
  for (int i = 0; i < 4; i++) {
    int ny = y + dy[i], nx = x + dx[i];
    if (i == (d + 2) % 4) continue;
    if (ny >= 0 && ny < n && nx >= 0 && nx < n && s[ny][nx] == '#') return false;
  }
  return true;
}

void solve() {
  cin >> n;
  fill_n((string*)s, 110, string(n, ' '));
  int y = n - 1, x = 0, d = 0;
  while (true) {
    s[y][x] = '#';
    if (!is_valid(y + dy[d], x + dx[d], d)) (d += 1) %= 4;
    if (!is_valid(y + dy[d], x + dx[d], d)) break;
    y += dy[d], x += dx[d];
  }
  for (int i = 0; i < n; i++) {
    cout << s[i] << endl;
  }
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int d;
  cin >> d;
  for (int i = 0; i < d; i++) {
    if (i) cout << endl;
    solve();
  }  

  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 <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int dy[] = {-1, 0, 1, 0};
int dx[] = {0, 1, 0, -1};
int n;
string s[110];

bool is_valid(int y, int x, int d) {
  if (y < 0 || y >= n || x < 0 || x >= n) return false;
  for (int i = 0; i < 4; i++) {
    int ny = y + dy[i], nx = x + dx[i];
    if (i == (d + 2) % 4) continue;
    if (ny >= 0 && ny < n && nx >= 0 && nx < n && s[ny][nx] == '#') return false;
  }
  return true;
}

void solve() {
  cin >> n;
  fill_n((string*)s, 110, string(n, ' '));
  int y = n - 1, x = 0, d = 0;
  while (true) {
    s[y][x] = '#';
    if (!is_valid(y + dy[d], x + dx[d], d)) (d += 1) %= 4;
    if (!is_valid(y + dy[d], x + dx[d], d)) break;
    y += dy[d], x += dx[d];
  }
  for (int i = 0; i < n; i++) {
    cout << s[i] << endl;
  }
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int d;
  cin >> d;
  for (int i = 0; i < d; i++) {
    if (i) cout << endl;
    solve();
  }  

  return 0;
}

```