As a Bangladeshi cricket fan, this World Cup was not a good memory for us. The only positive aspect for us was that the World Cup final, in which the team should have won, ended in a loss, and the winner was Australia.
From this, the setter got an idea of rotating a grid. Idea is,
Let's delve into the problem statement,
Suppose you have an empty grid with rows and columns. Additionally, you are given frequency of the lowercase Latin letters that you only use to fill the empty grid.
Your task is to fill the empty grid with the provided lowercase Latin letters (don’t have to use all of the letters every time) in a manner that ensures the grid remains unchanged when rotated anti-clockwise by , , or degrees. You can’t leave any cell empty.
The only line of the input contains integer numbers separated by space — representing frequency of lowercase Latin letters.
You can use at most times respectively to fill the grid.
If it is impossible to fill the empty grid according to your task, print a single line containing “no" without quotes.
Otherwise, print a single line containing “yes” without quotes, followed by lines each containing lowercase Latin letters, which describe the final state of the grid.
If there are multiple possible answers, you may print any of them.
Input | Output |
---|---|
4 4 4 4 0 0 0 0 4 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 | yes abcda dijib cjzjc bijid adcba |
Input | Output |
---|---|
0 4 0 0 0 0 0 0 0 0 3 0 0 0 4 0 0 0 0 4 0 0 0 4 0 4 | no |