#include
#include
int vis[22],ring[22];
const int prime[40]={1,1,0,0,1,0,1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,1,0,1,1};
int n,k;
void dfs(int k,int n)
{
if(k==n+1&&prime[ring[n]+ring[1]]==0)//长度符合,头尾符合,输出
{
printf("1 ");
for(int i=2;i<=n;i++)
printf("%d ",ring[i]);
printf("\n");
return ;
}
for(int i=2;i<=n;i++)
{
if(!vis[i]&&!prime[i+ring[k-1]])
{
vis[i]=1;
ring[k]=i;
dfs(k+1,n);
vis[i]=0;
}
}
}
int main()
{
int T;
T=1;
while(scanf("%d",&n)!=EOF,n)
{
printf("Case %d:\n",T++);
if(n==1)
{
printf("1\n");
continue;
}
if(n%2) //或者用 位与操作符 n&1
{
printf("No Answer\n");
continue;
}
memset(vis,0,sizeof(vis));
ring[1]=vis[1]=1;
dfs(2,n);
}
return 0;
}