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 <iostream>
#define ll long long
#define d double
#define ld long double
#define forn(i,m,n) for(ll int i=m;i<n;i++)
#define forr(i,m,n) for(ll int i=m;i>=n;i--)

#define vi vector<long long>
#define vf vector<long double>
#define iter std::vector<int>::iterator it;
#define usi unordered_set<long long>
#define osi set<long long>
#define vpi vector<pair<long long,long long> >
#define all(s)s.begin(),s.end()

#define pb push_back
#define popb pop_back
#define mp make_pair

#define read(a) ll a; cin>>a;
#define pn(a) cout << a << "\n"
#define pl(a) cout << a << endl
#define ps(a) cout << fixed << setprecision(19) << a << "\n";
using namespace std;

const int MAX=10000000;

void towerOfHanoi(int n, char from_rod,
                    char to_rod, char aux_rod)
{
    if (n == 1)
    {
        cout << "Move disk 1 from rod " << from_rod <<
                            " to rod " << to_rod<<endl;
        return;
    }
    towerOfHanoi(n - 1, from_rod, aux_rod, to_rod);
    cout << "Move disk " << n << " from rod " << from_rod <<
                                " to rod " << to_rod << endl;
    towerOfHanoi(n - 1, aux_rod, to_rod, from_rod);
}

///////
ll gcd2(ll a, ll b)
{
    // Everything divides 0
    if (a == 0)
       return b;
    if (b == 0)
       return a;

    // base case
    if (a == b)
        return a;

    // a is greater
    if (a > b)
        return gcd2(a-b, b);
    return gcd2(a, b-a);
}
///////

ll getSum(ll n)
{
    ll sum = 0;
    while (n != 0) {
        sum = sum + n % 10;
        n = n / 10;
    }
    return sum;
}

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

}
void sortString(string &str)
{
   sort(str.begin(), str.end());
   str.insert(0,"a");
   cout << str;
}
bool isPerfectSquare(long double x)
{
    if (x >= 0) {

        long long sr = sqrt(x);

        return (sr * sr == x);
    }
    return false;
}

ll count_same_digit(ll L, ll R)
{
    ll tmp = 0, ans = 0;

    // length of R
    ll n = log10(R) + 1;

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

        tmp = tmp * 10 + 1;

        for (ll j = 1; j <= 9; j++) {

            if (L <= (tmp * j)
                && (tmp * j) <= R) {
                ans++;
            }
        }
    }
    return ans;
}
int arraySortedOrNot(ll arr[], ll n)
{
    if (n == 1 || n == 0)
        return 1;

    if (arr[n - 1] < arr[n - 2])
        return 0;

    return arraySortedOrNot(arr, n - 1);
}
bool isPowerOfTwo(ll n)
{
   if(n==0)
   return false;

   return (ceil(log2(n)) == floor(log2(n)));
}
ll highestPowerof2(ll n)
{
    ll res = 0;
    for (ll i=n; i>=1; i--)
    {
        // If i is a power of 2
        if ((i & (i-1)) == 0)
        {
            res = i;
            break;
        }
    }
    return res;
}
int countDigit(long long n)
{
    int count = 0;
    while (n != 0)
    {
        n = n / 10;
        ++count;
    }
    return count;
}
ll distcalc(string s){
   ll dist=0;
   for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){dist+=2;}
    else if(s[i]!=s[i+1]){dist++;}
   }
   return dist;
}
int prefix[MAX + 1];

void primeset(){
    bool dp[MAX + 1];
    memset(dp, true, sizeof(dp));
    for (int p=2;p*p<=MAX; p++) {
        if (dp[p] == true) {
            for (int i = p * 2; i <= MAX; i += p)
                dp[i] = false;
        }
    }
    prefix[0] = prefix[1] = 0;
    for (int p = 2; p <= MAX; p++) {
        prefix[p] = prefix[p - 1];
        if (dp[p])
            prefix[p]++;
    }
}
 int solve(int L, int R){
    return prefix[R] - prefix[L];
}
int main()
{   ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll int t;
    cin>>t;
    while(t--){
      ll n; cin>>n;
      ll a[n]; forn(i,0,n){cin>>a[i];}
      vi v;
      forn(i,0,n){
        if(a[i]==1)
            v.pb(1);
        else{
            while(v.size()>0&&a[i]!=v[v.size()-1]+1){v.popb();}
            if(v.size()>0 && a[i]==v[v.size()-1]+1){v.popb();}
            v.pb(a[i]);
        }

        forn(j,0,v.size()-1){cout<<v[j]<<".";}
        cout<<v[v.size()-1]<<"\n";
    }
   }
    return 0;
}