#include
int main()
{
int a,b,c;
scanf("%d",&a);
b=a%1000;
a/=1000;
c=a%1000;
printf("%d %d %d",a,c,b);
}