//挺难的
#include <stdio.h>
int n,o,t,num;
int main()
{
scanf("%d",&n);
for(int i = 1;i <= n;i ++)
{
t = 0;
num = i;
while(num != 0)
{
t *= 10;
t += num%10;
num /= 10;
}
if(i == t)
printf("%d\n",t);
}
return 0;
}