Consider an array (a) consisting of (n) distinct integers. The Cartesian Tree of (a) is defined as a unique binary tree(^{\text{∗}}) that satisfies the following conditions: The tree consists of (n) vertices labeled from (1) to (n); For all pairs of vertices ((i,j)) such that (i) is a parent(^{\text{†}}) of (j), (a_i > a_j); For any vertex (i), all vertices in the left subtree(^{\text{‡}}) of (i) have labels less than (i); For any vertex (i), all vertices in the right subtree of (i) have labels greater than (i). Denote (r(a)) as the root of the Cartesian Tree, and (f_a(i)) as the parent of (i) in the Cartesian Tree. Define (E_a=\{(i,f_a(i)) \mid 1 \le i \le n, i \ne r(a)\}). Consider a permutation(^{\text{§}}) (q) of length (n). We define a series of arrays (p_1,p_2,\ldots,p_n) as follows: (p_1=q); For each (2 \le i \le n), (p_i) is obtained by incrementing the minimum element in (p_{i-1}) by (n). It can be shown that all elements in (p_i) are distinct. You are now given (n) and (S=\bigcup\limits_{i=1}^n E_{p_i}). To minimize input, (S) will be given in the form of a (n \times n) binary matrix (s). Denote (s_{i,j}) as the (j)-th character of the (i)-th row. (s_{i,j}=1) if and only if ((i,j) \in S). Please find any permutation (q) such that (S) can be obtained by the process above. It is guaranteed that the tests are generated to ensure a valid (q) always exists. (^{\text{∗}})A binary tree is a rooted tree, in which each node has no more than (2) children, referred to as the left child and the right child. (^{\text{†}})The parent of vertex (v) is the first vertex on the simple path from (v) to the root. The root has no parent. (^{\text{‡}})A subtree of vertex (v) is the subgraph of (v), all its descendants, and all the edges between them. $$$^{\ |