Author:  I. Ludov  Time limit:  1 sec  
Input file:  input.txt  Memory limit:  256 Mb  
Output file:  output.txt 
The city of Kislodriftinsk holds two prestigious drifting contests with different rules.
The Kislodriftinsk Drifting Championship consists of headtohead matches between all pairs of pilots. Judging rules exclude draws, so after every match exactly one participant receives one score point. The champion of Kislodriftinsk is determined as the pilot with maximum summary score (i. e. beating maximum number of other participants). Note that there may be several champions with equal scores.
The Kislodriftinsk Drifting Cup is conducted by olympic playoff system (aka single elimination). All participants are divided into pairs and winners of every pair are determined. Winners then make new pairs and the process is repeated until there is only one participant left, who becomes a cup winner.
Rising star of Kislodriftinsk motorsports, Kesha Tsuchiyev, has already became one of Championship winners this year and now wants to also win in the forthcoming Cup. His task is simplified by the fact that both contests have same set of participants and same judge teams. This implies that the result of every match in the Cup will be the same as in the Championship with the same pair of participants. Being one of Championship winners, Kesha will win a significant proportion of possible Cup matches.
However, Kesha suspects that in the case of unfortunate pair composition, he may not even advance to second stage, having lost the very first match. Your program must help him calculate any Cup schedule which leads him to victory, or determine that it is impossible.
Input file contains integers N T. Following N lines contain N integers each — a matrix of headtohead matches results. A number in row i and column j is equal 1 if ith pilot wins against jth and 0 otherwise. Diagonal contains zeroes. Kesha Tsuchiyev is a pilot number T, numbers start from zero.
Output file must contain N integers s_{0,i} which is a permutation of pilot numbers 0… N − 1 determining a schedule of playoff championship as follows: In the first round N / 2 matches are conducted between pairs (s_{0,0} vs s_{0,1}), (s_{0,2} vs s_{0,3}), etc. Winners of these matches form a sequence s_{1,i}. Then the process is repeated, i.e. N / 4 matches are conducted between pairs (s_{1,0} vs s_{1,1}), (s_{1,2} vs s_{1,3}) etc. The winner of playoff cup is the only number left in the sequence s_{k,i} for some k, and this number must be equal to T. If there is no solution, output file must contain a single integer −1.
2 ≤ N ≤ 64, N is a power of 2, 0 ≤ T < N
No.  Input file (input.txt ) 
Output file (output.txt ) 

1 


2 

