#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x,bool> memo; bool avail(int cur,ll mask,int le) { int i,x,y; if(mask==0) return true; if(__builtin_popcount(mask)>le) return false; if(le<=4) { if(memo.count(make_pair(cur*100+le,mask))) return memo[make_pair(cur*100+le,mask)]; } FOR(i,N) if((mask&(1LL<le) { if(le<=4) memo[make_pair(cur*100+le,mask)]=false; return false; } FOR(i,N) if((mask&(1LL<>N>>M>>K; FOR(x,100) FOR(y,100) mat[x][y]=1000; FOR(x,100) mat[x][x]=0; FOR(i,M) { cin>>x>>y; mat[x-1][y-1]=mat[y-1][x-1]=1; } FOR(i,N) FOR(x,N) FOR(y,N) mat[x][y]=min(mat[x][y],mat[x][i]+mat[i][y]); ll mask=0; for(i=N-1;i>0;i--) if(avail(0,mask|(1LL<