Terusky
Ancient civilizations often used letters to represent numbers.
In the Roman numeral system, 7 letters were employed: C, D, I, L, M, V, and X, enabling them to denote numbers from 1 to 3999.
Similarly, the Etruscans, who were neighbors to the Romans, used seven letters: A, E, I, J, O, U, and Y. They could represent numbers from 1 to 5040. Each number is expressed as a permutation of these seven characters, with each letter appearing exactly once. These permutations are sorted alphabetically, and the position of a permutation in this sorted list corresponds to the number it represents. For instance, AEIJOUY = 1, AEIJOYU = 2, AEIJUOY = 3, and YUOJIEA = 5040.
Write a program that identifies how the Etruscans would have recorded a given number.
Input
The program receives a natural number X ranging from 1 to 5040 as input.
Output
Output a string of seven characters, which is the Etruscan representation of the number X.