Cross-Number Puzzle

No attempts yetTime limit1sMemory limit128 MB

Problem

Write a program that prints the following two lines.

  1. The perfect numbers between $1000$ and $9999$ (inclusive). A perfect number is a positive integer equal to the sum of its proper divisors, where a proper divisor is any divisor of the number smaller than the number itself. For example, $6$ is a perfect number because $1 + 2 + 3 = 6$.
  2. Every integer between $100$ and $999$ (inclusive) that is equal to the sum of the cubes of its digits.

Input

There is no input.

Output

On the first line, print the perfect numbers between $1000$ and $9999$ (inclusive), separated by single spaces. On the second line, print every integer between $100$ and $999$ (inclusive) that equals the sum of the cubes of its digits, separated by single spaces.