#include <fstream>
using namespace std;
ifstream fin("date.in");
ofstream fout("date.out");
int a[50][50],x[50],p[50],n,m,gasit;
void citire()
{
int i,j;
fin>>n>>m;
while(fin>>i>>j) a[i][j]=a[j][i]=1;
}
int bun(int k)
{
if(k>1) if(a[x[k]][x[k-1]]==0) return 0;
if(k==n) if(a[x[1]][x[n]]==0) return 0;
return 1;
}
void back(int k)
{
if(!gasit)
for(int i=1;i<=n;i++)
if(!p[i])
{
x[k]=i; p[i]=1;
if(bun(k)) if(k==n) gasit=1;
else back(k+1);
p[i]=0;
}
}
int main()
{
citire();
back(1);
if(gasit) fout<<"da";
else fout<<"nu";
fin.close();
fout.close();
return 0;
}
|