int hw(int a)
{
int c = 0;
int d = 1;
int sum = 0;
d = a;
for (c = 0;a!=0;)
{
c = a % 10;
a /= 10;
sum = sum * 10 + c;
}
if (sum == d)
{
return sum;
}
else
{
return 0;
}
}
int main()
{
int n;
int a;
int b;
scanf("%d", &n);
for (a = 1; a <= n; a++)
{
b=hw(a);
if (b != 0)
{
printf("%d\n", b);
}
}
return 0;
}