#include <iostream>
using namespace std;

bool isOk(int n, int *v)
{
    int s[10] = {0};
    for (int i = 0; i < 5; i++)
    {
        if (s[v[i]]) //如果该数重复出现了，就可以直接返回false
            return false;
        s[v[i]] = 1; // 已出现过的数做标记
    }
    return true;
}

int getNum(int *v)
{
    int s = 0;
    for (int i = 0; i < 5; i++)
        s = s * 10 + v[i]; //逆序组合该数
    return s;
}

int main()
{
    int i, j, a, b, v[5] = {0};
    for (i = 12345; i <= 98765; i++)
    {
        for (a = 0, b = 1; a <= 5; a++, b *= 10)
            v[a] = i / b % 10;
        if (isOk(i, v))
            for (int j = 2; j < 9; j++)
                if (i * j == getNum(v))
                    cout << i;
    }

    return 0;
}