SP4378 TABLE5X5 - Twofive
Description
[English](/problems/TABLE5X5/en/) [Tiếng Việt](/problems/TABLE5X5/vn/)Having a 5x5-table, we make a right-table by filling letters from 'A'..'Y' into the table satisfying:
- Each letter is used exactly one time.
- The letters is ascending on every row.
- The letters is ascending on every column.
Each right-table is described by a 25-length string, see the example below for detail:
The right-table:
ABCDEFGHIJKLMNOPQRSTUVWXYis described by the string "ABCDEFGHIJKLMNOPQRSTUVWXY".
All descriptions are sorted ascending (following the dictionary order) and numbered from 1.
### Task
- Give an order, find the right description.
- Give a description, find the right order.
Input Format
- The first line contains a number (an order).
- The second line contains a description.
Output Format
- The first line contains the 25-length string desribing the order given.
- The second line contains the order of the given description.