using System;
using System.Collections.Generic;
namespace Test
{
class Algorithm
{
static int a, b, c, d, e, f, g, h, m;
static void Main(string[] args)
{
Console.ReadLine();
for (int i = 1; i <= 3; i++)
{
for (int j = 2; j <= 8; j++)
{
for (int k = 3; k <= 9 && k != 5; k++)
{
HashSet<int> result = new HashSet<int>();
a = i * 100 + j * 10 + k;
b = 2 * a;
if (b > 999) continue;
c = 3 * a;
if (c > 999) continue;
d = b / 100; //百分位
e = (b % 100) / 10; //十分位
f = b % 10; //个位
g = c / 100;
h = (c % 100) / 10;
m = c % 10;
result.Add(d);
result.Add(e);
result.Add(f);
result.Add(g);
result.Add(h);
result.Add(m);
if (!result.Contains(0) && result.Count == 6)
{
Console.WriteLine("{0} {1} {2}", a, b, c);
}
}
}
}
}
}
}