A tennis tournament is about to take place with $N$ players participating in it.
Every player plays with every other player exactly once and there are no ties. That is, every match has a winner and a loser. 
With Naman's birthday approaching, he wants to make sure that each player wins the same number of matches so that nobody gets disheartened.  
Your task is to determine if such a scenario can take place and if yes find one such scenario.

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- Each testcase contains of a single integer $N$ denoting number of players.

-----Output:-----
- If it's impossible for everyone to win the same number of matches, print "NO" (without quotes).
- Otherwise print "YES" (without quotes) and then print $N$ lines , each line should consist of a string containing only 0s and 1s and should be of size $N$. 
- If the jth character in the ith line is 1 then it means in the match between $i$ and $j$ , $i$ wins. 
- You will get a WA if the output does not correspond to a valid tournament, or if the constraints are not satisfied.
- You will get also WA verdict if any 2 lines have contradicting results or if a player beats himself.

-----Constraints-----
- $1 \leq T \leq 100$
- $2 \leq N \leq 100$

-----Subtasks-----
- 10 points : $2 \leq N \leq 6$
- 90 points :  Original Constraints. 

-----Sample Input:-----
2
3
2

-----Sample Output:-----
YES
010
001
100
NO

-----Explanation:-----
One such scenario for $N$ = $3$ is when player $1$ beats player $2$, player $2$ to beats player $3$ and player $3$ beats player $1$. Here all players win exactly $1$ match.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = '# cook your dish here\n\ndef calc(n) :\n a = n * (n-1)\n a = int(a/2)\n return a\n\nt = int(input())\ntt = 0\nwhile tt < t :\n tt = tt + 1\n n = int(input())\n num = calc(n)\n if num%n != 0 :\n  print("NO")\n else :\n  win = int(num/n)\n  print("YES")\n  i = 0\n  while i < n :\n   i = i + 1\n   j = i\n   str = ""\n   k = 0\n   while k < n :\n    str = str + "0"\n    k = k + 1\n   k = 0\n   while k < win :\n    if (j+k)%n==0 :\n     str = \'1\' + str[1:n]\n    elif (j+k)%n==(n-1) :\n     str = str[:n-1] + "1"\n    else :\n     kkk = (j+k)%n\n     str = str[0:kkk] + "1" + str[kkk+1:]\n    k = k + 1\n   print(str) \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13441