#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;

FILE *fin = fopen("recnik.in", "r");
FILE *fout = fopen("recnik.out", "w");


int T, n;
string s[200];
string p[200];
bool mark1[200], mark2[200];
bool found;
string rec1, rec2;

void input(){
    fscanf(fin, "%d", &n);
    char tmp[1500];

    for (int i=0; i<n; ++i){
        fscanf(fin, "%s", &tmp);
        s[i].assign(tmp);
        p[i]=s[i];
    }
}

bool resi(string rec1, string rec2, int z1, int z2){
    if (rec1.length()==rec2.length() && rec1==rec2){
        return true;
    }
    string tmp1, tmp2;
    if (rec1.length()>rec2.length()){
        tmp1=rec1;
        for (int i=0; i<n; i++)
            if (!mark2[i] && ((z1!=i)||((rec1.length()-rec2.length())!=s[i].length()))){
                tmp2=rec2+s[i];
                int v1=rec1.find(tmp2);
                int v2=tmp2.find(rec1);
                if (v1>-1 || v2>-1){
                    mark2[i]=true;
                    bool xXx=resi(rec1 , tmp2, z1, i);
                    if (xXx) return true;
                    mark2[i]=false;
                }
            }

    } else{
        tmp2=rec2;
        for (int i=0; i<n; i++)
            if (!mark1[i] && ((z2!=i)||(rec1.length()-rec2.length()!=s[i].length()))){
                tmp1=rec1+s[i];
                int v1=rec1.find(tmp1);
                int v2=tmp1.find(rec1);
                if (v1>-1 || v2>-1){
                    mark1[i]=true;
                    bool xXx=resi(tmp1, rec2, i, z2);
                    if (xXx) return true;
                    mark1[i]=false;
                }
            }


    }

    return false;
}


void solve(){
    found=false;
    for (int i=0; i<n; i++)
        for (int j=i+1; j<n; j++)
            if (s[i]==s[j]) found=true;

    for (int i=0; (i<n) && !found; i++){
        for (int j=0; j<200; ++j) mark1[j]=mark2[j]=false;
        mark1[i]=true;
        rec1=s[i]; rec2="";
        found=resi(rec1, rec2, i, -1);
    }

    if (found) fprintf(fout, "dvosmislen\n");
        else fprintf(fout, "nedvosmislen\n");
}



int main(){
    fscanf(fin, "%d", &T);

    while (T--){
        input();
        solve();
    }

    return 0;
}
