#include #include #include #include #include #include #include #include #include using namespace std; int main() { int a, b, c, d, e, f, g, h, i, j, n; cin >> n; set st; if (n == 1){ for (int a = 1; a <= 9; a++){ for (int b = 0; b <= 9; b++){ for (int c = 0; c <= 9; c++){ for (int d = 1; d <= 9; d++){ for (int e = 0; e <= 9; e++){ for (int f = 0; f <= 9; f++){ if((100*a + 10 + c) + (100*d + 10*e + f) == 1000 + 100*b + 10*c + 1){ st.insert(a); st.insert(b); st.insert(c); st.insert(d); st.insert(e); st.insert(f); st.insert(1); if (st.size() == 7) cout << 1 << b << c << 1 << endl; st.clear(); } } } } } } } } if (n == 2){ for (int a = 1; a <= 9; a++){ for (int b = 0; b <= 9; b++){ for (int c = 0; c <= 9; c++){ for (int d = 1; d <= 9; d++){ for (int e = 0; e <= 9; e++){ for (int f = 0; f <= 9; f++){ for (int g = 0; g <= 9; g++){ for (int h = 0; h <= 9; h++){ for (int i = 0; i <= 9; i++){ if((1000*a + 100*a + 10*b + c) + (1000*d + 100*e + 10*f + g) == 10000 + 1000*h + 100*b + 10*c + i){ st.insert(a); st.insert(b); st.insert(c); st.insert(d); st.insert(e); st.insert(f); st.insert(g); st.insert(h); st.insert(i); st.insert(1); if (st.size() == 10) cout << 1 << h << b << c << i << endl; st.clear(); } } } } } } } } } } } if (n == 3){ for (int a = 1; a <= 9; a++){ for (int b = 0; b <= 9; b++){ if (b == a) continue; for (int c = 0; c <= 9; c++){ if (c == a || c == b) continue; for (int d = 0; d <= 9; d++){ if (d == a || d == b || d == c) continue; for (int e = 0; e <= 9; e++){ if (e == a || e == b || e == c || e == d) continue; for (int f = 0; f <= 9; f++){ if (f == a || f == b || f == c || f == d || f == e) continue; for (int g = 1; g <= 9; g++){ if (g == a || g == b || g == c || g == d || g == e || g == f) continue; for (int h = 0; h <= 9; h++){ if (h == a || h == b || h == c || h == d || h == e || h == f || h == g) continue; for (int i = 0; i <= 9; i++){ if (i == a || i == b || i == c || i == d || i == e || i == f || i == g || i == h) continue; for (int j = 0; j <= 9; j++){ if (j == a || j == b || j == c || j == d || j == e || j == f || j == g || j == h || j == i) continue; if((100000*a + 10000*b + 1000*c + 100*d + 10*e + f) + (10000*g + 1000*d + 100*f + 10*g + i) == 100000*(a+1) + 10000*d + 1000*j + 100*e + 10*d + j){ cout << a+1 << d << j << e << d << j << endl; } } } } } } } } } } } } }