#include <iostream>
#include <cstdio>
using namespace std;
//英语 抄博友程序 模拟 枚举
int main()
{
while(1)
{
int nut;
cin>>nut;
if(nut<0)
{
break;
}
int peo;
int flag=0;
for(peo=nut-1;peo>=2;peo--)
{
int sum=nut;
int step=0;
for(step=1;step<=peo;step++)
{
if((sum-1)%peo!=0)
{
break;
}
sum=sum-1-(sum-1)/peo;
}
if(step>peo && (sum)%peo==0)//抄博友程序
{
flag=1;
break;
}
}
if(flag==1)
{
printf("%d coconuts, %d people and 1 monkey\n",nut,peo);
}else
{
printf("%d coconuts, no solution\n",nut);
}
}
return 0;
}