[an error occurred while processing this directive]
Listing: drumuri.PAS 
 const ni='input.txt'; 
       no='output.txt'; 
 type sir=array[1..20] of Byte; 
 var v:array[1..20] of sir; 
     nv,x,g:sir; 
     f:array[1..20] of Boolean; 
     i,j,k,n,r:Byte; 
     sol:Longint; 
 
  procedure citeste; 
 begin 
   Assign(input,ni); Reset(input); 
   Readln(n,r); 
   for i:=1 to n do nv[i]:=0; 
     for k:=1 to r do  
     begin 
       Readln(i,j); Inc(i); Inc(j); 
       Inc(nv[i]); v[i,nv[i]]:=j; 
       Inc(nv[j]); v[j,nv[j]]:=i 
     end 
 end; 
 
  procedure bkt(k,tk,vk:Byte); 
 begin 
   if k=n+1 then Inc(sol) 
   else  
     while tk<k do 
       if vk=nv[x[tk]]+1  
       then begin Inc(tk); vk:=1 end 
       else  
       begin 
         if not f[v[x[tk],vk]]  
         then  
         begin 
           x[k]:=v[x[tk],vk]; 
           f[x[k]]:=true; 
           bkt(k+1,tk,vk+1); 
           f[x[k]]:=false 
         end; 
         Inc(vk) 
       end 
 end; 
  
 procedure rezolva; 
 begin 
   for i:=2 to n do  
   begin g[i]:=nv[i]; f[i]:=false end; 
   g[1]:=nv[1];  
   f[1]:=true;  
   sol:=0; 
   x[1]:=1;  
   bkt(2,1,1) 
 end; 
 procedure scrie; 
 begin 
   Assign(output,no); Rewrite(output); 
   Writeln(sol); 
   Close(output) 
 end; 
 
 
 Begin
   citeste; 
   rezolva; 
   scrie 
 End.

[cuprins]