Problem: A big football championship will occur soon! n teams will compete in it, and each pair of teams will play exactly one game against each other.

There are two possible outcomes of a game:

  * the game may result in a tie, then both teams get 1 point; 
  * one team might win in a game, then the winning team gets 3 points and the losing team gets 0 points. 



The score of a team is the number of points it gained during all games that it played.

You are interested in a hypothetical situation when all teams get the same score at the end of the championship. A simple example of that situation is when all games result in ties, but you want to minimize the number of ties as well.

Your task is to describe a situation (choose the result of each game) so that all teams get the same score, and the number of ties is the minimum possible.

Input

The first line contains one integer t (1 ≤ t ≤ 100) — the number of test cases.

Then the test cases follow. Each test case is described by one line containing one integer n (2 ≤ n ≤ 100) — the number of teams.

Output

For each test case, print (n(n - 1))/(2) integers describing the results of the games in the following order: the first integer should correspond to the match between team 1 and team 2, the second — between team 1 and team 3, then 1 and 4, ..., 1 and n, 2 and 3, 2 and 4, ..., 2 and n, and so on, until the game between the team n - 1 and the team n.

The integer corresponding to the game between the team x and the team y should be 1 if x wins, -1 if y wins, or 0 if the game results in a tie.

All teams should get the same score, and the number of ties should be the minimum possible. If there are multiple optimal answers, print any of them. It can be shown that there always exists a way to make all teams have the same score.

Example

Input


2
2
3


Output


0 
1 -1 1 

Note

In the first test case of the example, both teams get 1 point since the game between them is a tie.

In the second test case of the example, team 1 defeats team 2 (team 1 gets 3 points), team 1 loses to team 3 (team 3 gets 3 points), and team 2 wins against team 3 (team 2 gets 3 points).

Solution (in CPP):

Solution:
// Author : Epsilon573
// If it works, don't touch it.

#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

const ll mod  = 1e9+7;
const ld eps  = 1e-9 ;
const ll maxn = 1e5+1;
const ll inf  = 1e15 ;
const ll minf = -inf ;

#define mp make_pair
#define pb push_back
#define endl "\n"

#ifdef EPSILON

    #define deb(args...)       cerr << "[ " #args << " ] : " , debug(args);
    #define debug(args...)     (Debugger()) , args
 
    class Debugger
    {
        public:
        Debugger(const std::string& _separator = ", ") :
        first(true), separator(_separator){}
 
        template<typename ObjectType>
        Debugger& operator , (const ObjectType& v)
        {
            if(!first)
                std::cerr << separator;
            std::cerr << v;
            first = false;
            return *this;
        }
        ~Debugger() {  std::cerr << endl;}
 
        private:
        bool first;
        std::string separator;
    };
 
    template <typename T1, typename T2>
    inline std::ostream& operator << (std::ostream& os, const std::pair<T1, T2>& p)
    {
        return os << "(" << p.first << ", " << p.second << ")";
    }
 
    template<typename T>
    inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v)
    {
        bool first = true;
        os << "[";
        for(unsigned int i = 0; i < v.size(); i++)
        {
            if(!first)
                os << ", ";
            os << v[i];
            first = false;
        }
        return os << "]";
    }
 
    template<typename T>
    inline std::ostream &operator << (std::ostream & os,const std::set<T>& v)
    {
        bool first = true;
        os << "[";
        for (typename std::set<T>::const_iterator ii = v.begin(); ii != v.end(); ++ii)
        {
            if(!first)
                os << ", ";
            os << *ii;
            first = false;
        }
        return os << "]";
    }
 
    template<typename T1, typename T2>
    inline std::ostream &operator << (std::ostream & os,const std::map<T1, T2>& v)
    {
        bool first = true;
        os << "[";
        for (typename std::map<T1, T2>::const_iterator ii = v.begin(); ii != v.end(); ++ii)
        {
            if(!first)
                os << ", ";
            os << *ii ;
            first = false;
        }
        return os << "]";
    }
 
#else
    #define deb(args...)
    #define debug(args...)
#endif

bool solve()
{
    ll n,h;
    cin >> n;

    h = (n-1)/2;

    vector<vector<ll>> v(n,vector<ll> (n,-1));
    vector<ll> score(n),wins(n,0);
    if((n-1)&1) 
    {
        for(ll i=0 ; i<n ; ++i)
            v[i][n-1-i] = 0;         
    }

    // for(ll i=0 ; i<n-1 ; ++i)
    // {
    //     ll cntl = 0, cntw = 0;

    //     for(ll j=0 ; j<n ; ++j)
    //     {
    //         if(i==j) continue;

    //         if(i<j && v[i][j]==1) cntw++;
    //         else if(v[j][i]==-1) cntw++;
    //     }
    //     for(ll j=0 ; j<n ; ++j)
    //     {
    //         if(i==j) continue;

    //         if(i<j && v[i][j]==-1) cntl++;
    //         else if(v[j][i]==1) cntl++;
    //     }

    //     ll j = 0;
        
    //     while(cntw<h && j<n)
    //     {
    //         if(j==i) j++;

    //         ll x = min(i,j) , y=max(i,j);

    //         if(v[x][y]==3)
    //         {
    //             if(i<j){
    //                 v[i][j] = 1;
    //             }
    //             else
    //             {
    //                 v[j][i] = -1;
    //             }
    //             cntw++;
    //         }

    //         j++;
    //     }

    //     while(cntl<h && j<n)
    //     {
    //         if(j==i) j++;

    //         ll x = min(i,j) , y=max(i,j);

    //         if(v[x][y]==3)
    //         {
    //             if(i<j){
    //                 v[i][j] = -1;
    //             }
    //             else
    //             {
    //                 v[j][i] = 1;
    //             }
    //             cntl++;
    //         }

    //         j++;            
    //     }
    // } 

    for(ll i=0 ; i<n ; ++i)
    {
        ll j;

        if(i<=n/2)
{
        for(j=i+1 ; j<n && wins[i]<h ; ++j)
        {
            if(v[i][j]==0) continue;
            else
            {
                v[i][j] = 1;
                wins[i]++;
            }
        }

        while(j<n)
        {
            if(v[i][j]==0){
                j++; 
                continue;
            }
            wins[j]++;
            j++;
        }
}
else
{
        for(j=n-1 ; j>i && wins[i]<h ; --j)
        {
            if(v[i][j]==0) continue;
            else
            {
                v[i][j] = 1;
                wins[i]++;
            }
        }

        while(j>i)
        {
            if(v[i][j]==0){
                j--; 
                continue;
            }
            wins[j]++;
            j--;
        }    
}
    }

    for(ll i=0 ; i<n ; ++i)
    {
        for(ll j=i+1 ; j<n ; ++j)
        {
            cout << v[i][j] << " ";

            if(v[i][j]==-1)
                score[j]+=3;
            else if(v[i][j]==1)
                score[i]+=3;

        }
    }

    cout << endl;
    return true;    
}

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    #ifdef EPSILON
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    freopen("error.txt","w",stderr);
    #endif

    ll t=1;
    cin >> t;

    while(t--)
    {
        if(solve())
        {
            // do this;
        }
        else
        {
            // do this;
        }
    }

    return 0;
}