#Algorithm
枚举
#Hint
文件末尾不能有空行
#Code
#include <cstring>
#include <iostream>
using namespace std;
int n;
bool flag;
bool b[10];
void solve()
{
flag = false;
for (int f = 0; f < 10; f++)
for (int g = 0; g < 10; g++)
for (int h = 0; h < 10; h++)
for (int i = 0; i < 10; i++)
for (int j = 0; j < 10; j++)
{
memset(b, 0, sizeof(b));
b[f] = true;
if (b[g]) continue; b[g] = true;
if (b[h]) continue; b[h] = true;
if (b[i]) continue; b[i] = true;
if (b[j]) continue; b[j] = true;
long long abcde = n * (f * 10000 + g * 1000 + h * 100 + i * 10 + j);
if (abcde > 99999) continue;
int a = abcde / 10000; abcde %= 10000;
if (b[a]) continue; b[a] = true;
int bb = abcde / 1000; abcde %= 1000;
if (b[bb]) continue; b[bb] = true;
int c = abcde / 100; abcde %= 100;
if (b[c]) continue; b[c] = true;
int d = abcde / 10; abcde %= 10;
if (b[d]) continue; b[d] = true;
int e = abcde;
if (b[e]) continue;
cout << a << bb << c << d << e << " / " << f << g << h << i << j << " = " << n << endl;
flag = true;
}
if (!flag) cout << "There are no solutions for " << n << "." << endl;
}
int main()
{
cin >> n;
if (n == 0) return 0;
solve();
for (;;)
{
cin >> n;
if (n == 0) break;
cout << endl;
solve();
}
}