Problem: <image>

William is a huge fan of planning ahead. That is why he starts his morning routine by creating a nested list of upcoming errands.

A valid nested list is any list which can be created from a list with one item "1" by applying some operations. Each operation inserts a new item into the list, on a new line, just after one of existing items a_1  .  a_2  .  a_3  .   ⋅⋅⋅   .\,a_k and can be one of two types: 

  1. Add an item a_1  .  a_2  .  a_3  .  ⋅⋅⋅  .  a_k  .  1 (starting a list of a deeper level), or 
  2. Add an item a_1  .  a_2  .  a_3  .  ⋅⋅⋅  .  (a_k + 1) (continuing the current level). 

Operation can only be applied if the list does not contain two identical items afterwards. And also, if we consider every item as a sequence of numbers, then the sequence of items should always remain increasing in lexicographical order. Examples of valid and invalid lists that are shown in the picture can found in the "Notes" section.

When William decided to save a Word document with the list of his errands he accidentally hit a completely different keyboard shortcut from the "Ctrl-S" he wanted to hit. It's not known exactly what shortcut he pressed but after triggering it all items in the list were replaced by a single number: the last number originally written in the item number.

William wants you to help him restore a fitting original nested list.

Input

Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 10). Description of the test cases follows.

The first line of each test case contains a single integer n (1 ≤ n ≤ 10^3), which is the number of lines in the list.

Each of the next n lines contains a single integer a_i (1 ≤ a_i ≤ n), which is what remains of William's nested list.

It is guaranteed that in each test case at least one fitting list exists.

It is guaranteed that the sum of values n across all test cases does not exceed 10^3.

Output

For each test case output n lines which represent a valid nested list, which could become the data provided to you by William.

If there are multiple answers, print any.

Example

Input


2
4
1
1
2
3
9
1
1
1
2
2
1
2
1
2


Output


1
1.1
1.2
1.3
1
1.1
1.1.1
1.1.2
1.2
1.2.1
2
2.1
2.2

Note

In the second example test case one example of a fitting list is:

1

1.1

1.1.1

1.1.2

1.2

1.2.1

2

2.1

2.2

This list can be produced by using the sequence of operations shown below: <image>

  1. Original list with a single item 1. 
  2. Insert item 2 by using the insertion operation of the second type after item 1. 
  3. Insert item 1.1 by using the insertion operation of the first type after item 1. 
  4. Insert item 1.2 by using the insertion operation of the second type after item 1.1. 
  5. Insert item 1.1.1 by using the insertion operation of the first type after item 1.1. 
  6. Insert item 1.1.2 by using the insertion operation of the second type after item 1.1.1. 
  7. Insert item 1.2.1 by using the insertion operation of the first type after item 1.2. 
  8. Insert item 2.1 by using the insertion operation of the first type after item 2. 
  9. Insert item 2.2 by using the insertion operation of the second type after item 2.1. 

Solution (in CPP):

Solution:
#include<bits/stdc++.h>
#include <limits>

using namespace std;

#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define ins insert
#define sb substr
#define con continue
#define ub upper_bound
#define lb lower_bound
#define pll pair<ll,ll>
#define pld pair<ld,ld>

ll modexp(ll x, ll n);
ll getFractionModulo(ll a, ll b);
ll power(ll x, ll y);
ll mpower(ll x, ll y, ll p);
bool isPrime(ll n);
ll const N=(ll)(1e5+1);
ll const mod=(ll)(1e9+7);
vector<ll>g[N];
ll visited[N]={0};
ll parent[N]={0};
ll a[N]={0};
ll flag=0;
vector<ll>no;

void dfs(ll v)
{
    if(visited[v])
        return;

    visited[v]=true;
    no.pb(v);

    for(auto x:g[v])
    {
        if(!visited[x])
        {
            dfs(x);
        }
    }

}

ll gcd(ll a,ll b)
{
    if(a==0)
        return b;

    return gcd(b%a,a);
}

ll binomialCoeff(ll n, ll r)
{
    // Optimization for the cases when r is large
    if (r > n - r)
        r = n - r;

    // The array C is going to store last row of
    // pascal triangle at the end. And last entry
    // of last row is nCr
    ll C[r + 1];
    memset(C, 0, sizeof(C));

    C[0] = 1; // Top row of Pascal Triangle

    // One by constructs remaining rows of Pascal
    // Triangle from top to bottom
    for (ll i = 1; i <= n; i++) {

        // Fill entries of current row using previous
        // row values
        for (ll j = min(i, r); j > 0; j--)

            // nCj = (n-1)Cj + (n-1)C(j-1);
            C[j] = (C[j] + C[j - 1]) % mod;
    }
    return C[r];
}
bool isPerfect(ll N)
    {
        if ((sqrt(N) - floor(sqrt(N))) != 0)
            return false;
        return true;
    }


ll setBitNumber(ll n)
{
    n |= n >> 1;

    n |= n >> 2;

    n |= n >> 4;
    n |= n >> 8;
    n |= n >> 16;

    n = n + 1;

    return (n >> 1);
}

ll myXOR(ll x, ll y)
{
    ll res = 0; // Initialize result

    // Assuming 32-bit Integer
    for (int i = 31; i >= 0; i--)
    {
       // Find current bits in x and y
       bool b1 = x & (1 << i);
       bool b2 = y & (1 << i);

        // If both are 1 then 0 else xor is same as OR
        bool xoredBit = (b1 & b2) ? 0 : (b1 | b2);

        // Update result
        res <<= 1;
        res |= xoredBit;
    }
    return res;
}

long double squareRoot(ll number, ll precision)
{
    ll start = 0, end = number;
    ll mid;

    // variable to store the answer
    long double ans;

    // for computing integral part
    // of square root of number
    while (start <= end) {
        mid = (start + end) / 2;
        if (mid * mid == number) {
            ans = mid;
            break;
        }

        // incrementing start if integral
        // part lies on right side of the mid
        if (mid * mid < number) {
            start = mid + 1;
            ans = mid;
        }

        // decrementing end if integral part
        // lies on the left side of the mid
        else {
            end = mid - 1;
        }
    }

    // For computing the fractional part
    // of square root upto given precision
    long double increment = 0.1;
    for (int i = 0; i < precision; i++) {
        while (ans * ans <= number) {
            ans += increment;
        }

        // loop terminates when ans * ans > number
        ans = ans - increment;
        increment = increment / 10;
    }
    return ans;
}

bool sortbyfirstdesc(const pair<ll,ll> &a,
                   const pair<ll,ll> &b)
{
       return a.first>b.first;
}


int main()
{
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
            ll  t,i,l,h,r,x,y,z,d,f,s,k1,k2,c,a,w,b,m,n1,M=(ll)(1e9+7);

            ll  n,K;
            ll  p,q,j,k;

           // cout<<perfe.size()<<endl;
           // cout<<gp<<endl;

            cin>>t;


          //  t=1;

            while(t--)
            {
                        cin>>n;

                        string arr[n];


                        for(i=0;i<n;i++)
                        {
                            cin>>arr[i];
                        }

                        vector<string>ans;

                        i=0;
                        string temp="";

                        stack<string>st;
                        while(i<n)
                        {
                                if(arr[i]=="1")
                                {
                                    if(temp=="")    temp+="1";
                                    else            temp+=".1";

                                    ans.pb(temp);
                                    st.push(temp);
                                }
                                else
                                {

                                    while(st.size())
                                    {
                                        string temp1="";
                                        temp=st.top();
                                        st.pop();

                                        j=temp.size()-1;
                                        while(j>=0 && temp[j]!='.')
                                        {
                                            temp1+=temp[j];
                                            j--;
                                        }

                                        reverse(temp1.begin(),temp1.end());
                                        if(stoi(temp1)+1==stoi(arr[i]))
                                        {
                                            break;
                                        }
                                    }

                                    if(st.empty())  temp="";
                                    else
                                    {
                                        while(temp.size() && temp.back()!='.')
                                            temp.pop_back();
                                    }
                                    if(temp.size() && temp.back()!='.') temp+='.';
                                    temp+=arr[i];
                                    ans.pb(temp);
                                    st.push(temp);
                                }

                                i++;


                        }


                        for(i=0;i<ans.size();i++)
                        {
                            cout<<ans[i]<<endl;
                        }



            }

}


ll mpower(ll x, ll y, ll p){
    ll res = 1;
    x = x % p;
    while(y > 0){
        if(y & 1) res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

ll getFractionModulo(ll a, ll b)
{
	ll c = gcd(a, b);

	a = a / c;
	b = b / c;

	// (b ^ m-2) % m
	ll d = modexp(b, mod - 2);

	// Final answer
	ll ans = ((a % mod) * (d % mod)) % mod;

	return ans;
}

ll modexp(ll x, ll n)
{
	if (n == 0) {
		return 1;
	}
	else if (n % 2 == 0) {
		return modexp((x * x) % mod, n / 2);
	}
	else {
		return (x * modexp((x * x) % mod, (n - 1) / 2) % mod);
	}
}

ll power(ll x, ll y){
    ll res = 1;
    while (y > 0){
        if (y & 1) res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}
bool isPrime(ll n){
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    ll p=sqrt(n);
    for(ll i=5;i<=p;i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
            return false;
    return true;
}
/*
65 183
17 8
10 9*/