type
 niz=array [0..1000,0..1000] of char;
var
 s:niz;
 t,i,n,j,o,q:integer;
 f,g:text;
 c:char;
procedure qsort(l,r:integer);
 var
  si,sj,k:char;
  i,j,o:integer;
  y:array[0..1000,0..1000] of char;
   begin
    i:=l;
    j:=r;
    si:=s[i,q];
    sj:=s[j,q];
    k:=s[(l+r) div 2,q];
     repeat
      while ord(si)<ord(k) do
       i:=i+1;
      while ord(k)<ord(sj) do
       j:=j-1;
      if not(i>j) then
       begin
        for o:=1 to 100 do
        begin
         y[i,o]:=s[i,o];
          s[i,o]:=s[j,o];
          s[j,o]:=y[i,o];
       end;
          i:=i+1;
          j:=j-1;
       end;
    until i>j;
     if l<j then qsort(l,j);
     if i<r then qsort(i,r);
   end;
begin
q:=1;
readln(f,t);
 for i:=1 to t do
  begin
  assign(f,'recnik.in');
  reset(f);
  assign(g,'recnik.out');
  rewrite(g);
   readln(f,n);

      for j:=1 to n do begin
        o:=1;
       while not eoln(f) do
        begin
         read(f,c);
         s[j,o]:=c;
         o:=o+1;
      end;
     readln(f);
     end;
   if t=1 then
   writeln(g,'dvosmislen');
   if t>1 then
    writeln(g,'nedvosmislen');

end;
close(f);
close(g);



end.
