#include <iostream>
#include <cmath>
using namespace std;
int prodcif(int n)
{
int p = 1;
while (n)
{
int c = n % 10;
p *= c;
n /= 10;
}
return p;
}
int main()
{
int n, cnt = 0;
cin >> n;
for (int i = 1; cnt <= n; ++i)
{
int x = prodcif(i);
if (sqrt(x) * sqrt(x) == x)
{
cnt++;
cout << i << " ";
}
}
return 0;
}