#include<bits/stdc++.h>
using namespace std;
int main()
{
int m,n,t,res,store,mn_beer_time,mn,mx,res_mx;
while(scanf("%d%d%d",&m,&n,&t)!=EOF)
{
if(m==1 || n==1)
{
printf("%d\n",t);
continue;
}
(m>n) ? store=m,m=n,n=store : m=m,n=n;
res_mx = t/m;
if(t%m==0)
{
printf("%d\n",res_mx);
}
else
{
mn_beer_time = t%m;
int len = t/n;
for(res=1; res<=len ; res++)
{
mx = (t-(res*n))/m + res;
mn = t-(((mx-res)*m)+(res*n));
if(mn<mn_beer_time && mn>=0)
{
mn_beer_time = mn;
res_mx = mx;
}
if(mn==0)
{
break;
}
}
if(mn_beer_time==0)
{
printf("%d\n",mx);
}
else
{
printf("%d %d\n",res_mx,mn_beer_time);
}
}
}
return 0;
}