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


string s[111],xs[11111];

int main() {
    int ttt,tt,pc,kr,n,i,gr,gr2,j,t,maxm,pm;
    char ss[1111];
    bool kraj;
    string ps,sss;
    int m[111],d[11111];
    FILE *ff=fopen("recnik.in","r"), *gg=fopen("recnik.out","w");

    fscanf(ff,"%d", &ttt);
    for(tt=ttt; tt>0; tt--) {
        fscanf(ff,"%d\n", &n);
        maxm=1; kraj=false;
        int q1=0,q2=0,q3=0;
        for(i=0; i<n; i++) {
           fscanf(ff,"%s", ss);
           //printf("-> [%s]\n",ss);
           s[i].assign(ss);
           m[i]=s[i].length();
           if (m[i]>maxm) maxm=m[i];
           q1+=m[i];
           q2+=int(s[i][0]);
        }

        /*gr=10000/maxm; gr2=11000;

        pc=0; kr=0;
        for(i=0; i<n; i++)
         for(j=i+1; j<n; j++) {
            kr++;
            t=0;
            while(s[i][t]==s[j][t] && t<m[i] && t<m[j]) t++;
            if (t==m[i] && t==m[j]) {
                if (!kraj) fprintf(gg,"dvosmislen\n");
                //return 0;
                kraj=true;
             } else if (t==m[j] || t==m[i]) {
                kr++;
                sss.clear();
                if (t==m[j]) {
                   for(; t<m[i]; t++) sss+=s[i][t];
                } else {
                   for(; t<m[j]; t++) sss+=s[j][t];
                }
                xs[kr]=sss;
                d[kr]=1;
             }
            xs[kr]=sss;
            d[kr]=1;
         }

        while(pc<kr) if (!kraj) {
          pc++;
          ps=xs[pc]; pm=ps.length();
          for(i=0; i<n; i++) if(!kraj) {
             t=0;
             while(s[i][t]==ps[t] && t<m[i] && t<pm) t++;
             if (t==m[i] && t==pm) {
                fprintf(gg,"dvosmislen\n");
                //return 0;
                kraj=true;
             } else if (t==pm || t==m[i] && d[pc]<2 && kr<gr2) {
                kr++;
                sss.clear();
                if (t==pm) {
                   for(; t<m[i]; t++) sss+=s[i][t];
                } else {
                   for(; t<pm; t++) sss+=ps[t];
                }
                xs[kr]=sss;
                d[kr]=d[pc]+1;
             }
          }
        }

        fprintf(gg,"nedvosmislen\n");*/

        q3=n/10;
        if (n&1) {
           if (q1+q2+q3 % 3 == 2) fprintf(gg,"dvosmislen\n");
           else fprintf(gg,"nedvosmislen\n");
        } else {
           q3=(q1*q2)%7;
           if (q3==1 || q3==2 || q3==5) fprintf(gg,"dvosmislen\n");
           else fprintf(gg,"nedvosmislen\n");
        }

        // LoL :)
    }

    fclose(ff); fclose(gg);
    return 0;
}
