#include <stdio.h>
#include <string.h>
main()
{
int a[10]={1,2,3,4,5,6,7,8,9};
int i, n=9, m=3;
for (i=0; i<n; i++)
printf("%d ", a[i]);
printf("\n");
while (n)
{
for (i=0; i<m; i++)
{
a[n] = a[0];
memmove(a, a+1, n*sizeof(int));
}
printf("%d ", a[0]);
memmove(a, a+1, --n*sizeof(int));
}
}