#include <stdio.h>

int main() {
    int num, digit, sum;
    int i = 0;
    int n;

    for (n = 100; n < 1000; n++) {
        sum = 0;
        num = n;
        while (num > 0) {
            digit = num % 10;
            sum += digit * digit * digit;
            num /= 10;
        }
        if (sum == n) {
            if (i == 2) {
                printf("\n");
                i = 0;
            }
            printf("%d ", n);
            i++;
        }
    }

    return 0;
}
