#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a[9];
    for (int i = 0; i < 9; i++)
        a[i] = i + 1;
    do
    {
        int a1 = a[0] * 100 + a[1] * 10 + a[2];
        int a2 = a[3] * 100 + a[4] * 10 + a[5];
        int a3 = a[6] * 100 + a[7] * 10 + a[8];
        if (a3 == 3 * a1 && a2 == 2 * a1)
            printf("%d %d %d\n", a1, a2, a3);
    } while (next_permutation(a, a + 9));
    return 0;
}
