An Unfair Game

Time Limit: 10000/5000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)

Problem Description

There are n people and n target, everyone should get one target, no two people get the same target, the last one who get the target should be punished, there is only one person will be punished, so if more than one person are the last, no one will be punished.

As the judge, you know exactly how much time that people i getting target j will spend, but there are no people know how much time he needs.

You need to arrange for a target to everyone, and you want the i-th people to be punished (Now you know why it is an unfair game?).

Input

The input contains several test, and ends with EOF.

For each test, the first line has an integer n, which is the number of people and target, next there is an integer matrix which size is n*n, the i-th row and the j-th colume of matrix means the time that i-th person needs to get target j.

Next line is a number m, the number of the person who you want to be punished.

1 ≤ m < n ≤ 100.

Output

 Each test print one line, the number of the target that m-th person gets, if there are more than one answer, print all of them. If there is no answer, only print -1.

Sample Input

3
1 2 3
2 3 4
3 4 5
3
3
3 3 3
2 2 2
1 1 1
3

Sample Output

2 3
-1

Source

UUZ

Manager

Information
Solved Number7
Submit Number14
Problem Tags
graphs
No tag edit access
温馨提示:AC后可以编辑标签哦. ^-^
Login
LoginCancel