#include<algorithm>
#include<vector>
#include<iostream>
using namespace std;
int judge(int x,int r)
{
	int temp;int sum=x;
	for(temp=r;temp>0;--temp)
	{
		if((sum-1)%r!=0)return 0;
		sum=sum-(sum-1)/r-1;
	}
	if(sum>0&&sum%r==0)return 1;
	else return 0;
}
int main()
{
	int r,x;
	while(true)
	{
	vector <int> a;
	int flag=0;
	cin>>x;
	if(x==-1)break;
	else
	{
		for(r=2;r<x;++r)
		{
			if(judge(x,r)==1)
			{
			a.push_back(r);
			flag=1;
			}
		}
	}
	if(flag==1)
	{
		int max=*max_element(a.begin(),a.end());
		cout<<x<<" "<<"coconuts"<<", "<<max<<" people and 1 monkey"<<endl;
		for(int count=0;count<a.size();count++)
		{
			a.erase(a.begin()+count);
		}
	}
	if(flag==0)
	{
		cout<<x<<" "<<"coconuts"<<", "<<"no solution"<<endl;
	}
	}
}