The problem
I have prepared a problem as follow: There is this secret sequence $$$S$$$ consists of $$$N$$$ distinct numbers. Given a matrix $$$G$$$ of size $$$N \times N$$$, where $$$G_{i,j}=$$$\t{Y}' if $$$S_i>S_j$$$. Otherwise, $$$G_{i,j}=$$$
\t{?}', meaning we have no information about the relation of $$$S_i$$$ and $$$S_j$$$, whether they are larger or smaller. You need to output a sequence $$$P = {P_1, P_2, ..., P_n}$$$, such that $$$S_{P_1} > S_{P_2} > ... > S_{P_n}$$$, or report that it is impossible to determined exactly the order.
Example
\begin{array}{|c|c|c|} \hline a & b & c \cr \hline d & e & f \cr \hline g & h & i \cr \hline \end{array}