Problems
Dr Who`s Banquet
Dr Who`s Banquet
Dr. Who is organizing a banquet and will be inviting several guests. A guest is happy if he can chat with a fixed number of other guests. We assume that guests cannot talk to themselves. Help Dr. Who make all his guests happy, if possible, by organizing chats between guests.
\InputFile
Contains several data sets, and each data set is encoded on a line. A data set consists of $n~(n \le 10000)$ positive integers $a_1, a_2, ..., a_n$. Each number $a_i~(a_i \le 1000, 1 \le i \le n)$ is the number of chat partners guest $i$ would like to have.
\OutputFile
If you can make all the guests happy, you should post "\textbf{ok}". If not all the guests to be happy, you should get the message "\textbf{fail}". After each message should be displayed an empty string.
In the following table, an input data with $4$ data sets and the associated output is shown.
Input example #1
3 3 1 1 4 4 3 3 2 2 2 3 3 1 1 2 2 2 2
Output example #1
fail ok fail ok