#include
#include
#include
using namespace std;
int fib[1000];
int main()
{
int n; //n为模
int M;
cin >> n;
fib[0] = 0;
fib[1] = 1 % n;
for(int i=2; i<=n * n; i++) {
fib[i] = (fib[i - 2] + fib[i - 1]) % n;
if(fib[i - 2] == 1 && fib[i - 1] == 0) {
M = i - 1;
break;
}
}
for(int i =0;i<=M;i++){
printf("%d ",fib[i]);
}
cout << M <// 循环节
return 0;
}