#include <cstdio>
#include <string.h>
#include <algorithm>

char reci[105][1005];

bool used[105];

bool cmp(int i1, int i2)
{
    int i;
    for ( i=0;reci[i1][i]!=0 && reci[i2][i]!=0 ; i++)
    if ( reci[i1][i]<reci[i2][i] ) return true;
    else if ( reci[i1][i]>reci[i2][i] ) return false;

    return reci[i1][i]==0 ;
}

bool rek(int rec, int poc)
{

}
int rasp[105];
int T,n;

int main()
{
    scanf("%d",&T);
    for ( int cnt=0;cnt<T;cnt++)
    {
        scanf("%d",&n);
        for ( int i=0;i<n;i++,rasp[i]=i)
            scanf("%s",reci[i]);
        std::sort(rasp,rasp+n,cmp);
        bool dvosmislen=false;
        int trec, poc;
        for ( int g=0;g<n-1;g++)    // kljucni deo zadatka
        {
            rek(g,0)
        }
        if ( dvosmislen ) printf("dvosmislen\n");
        else              printf("nedvosmislen\n");
    }
    return 0;
}

