/*ID:nealgav1
PROG:friday
LANG:C++
*/
#include<cstdio>
#include<cstring>
#define N 403
int week[N][7];
void search()
{ memset(week,0,sizeof(week));
int i,j,k,year,ri,count=0;
bool flag=0;
for(i=1900,year=0;i<1900+N;i++,year++)
{ if(year)
{for(int zz=0;zz<7;zz++)
week[year][zz]=week[year-1][zz];
}
if(i%100==0)
{
if(i==2000)
{flag=1;
}
else flag=0;
}
else if(i%4==0)flag=1;
else flag=0;
for(j=1;j<=12;j++)
{
if(j==4||j==6||j==9||j==11)
{
ri=30;
}
else if(j==2)
{
if(flag)
ri=29;
else ri=28;
}
else
ri=31;
for(k=1;k<=ri;k++)
{
count++;
if(k==13)
{week[year][count%7]++;count+=ri-13;break;}
}
}
}
}
int main()
{
freopen("friday.in","r",stdin);
freopen("friday.out","w",stdout);
int m;search();
while(scanf("%d",&m)!=EOF)
{
printf("%d ",week[m-1][6]);
for(int i=0;i<6;i++)
{
printf("%d",week[m-1][i]);
if(i==5)
printf("\n");
else printf(" ");
}
}
return 0;
}