Ten Words of Wisdom
In the game show "Ten Words of Wisdom", there are $$$n$$$ participants numbered from $$$1$$$ to $$$n$$$, each of whom submits one response. The $$$i$$$-th response is $$$a_i$$$ words long and has quality $$$b_i$$$. No two responses have the same quality, and at least one response has length at most $$$10$$$.The winner of the show is the response which has the highest quality out of all responses that are not longer than $$$10$$$ words. Which response is the winner?
In the first test case, the responses provided are as follows:  Response 1: $$$7$$$ words, quality $$$2$$$  Response 2: $$$12$$$ words, quality $$$5$$$  Response 3: $$$9$$$ words, quality $$$3$$$  Response 4: $$$9$$$ words, quality $$$4$$$  Response 5: $$$10$$$ words, quality $$$1$$$ We can see that the responses with indices $$$1$$$, $$$3$$$, $$$4$$$, and $$$5$$$ have lengths not exceeding $$$10$$$ words. Out of these responses, the winner is the one with the highest quality.Comparing the qualities, we find that:   Response 1 has quality $$$2$$$.  Response 3 has quality $$$3$$$.  Response 4 has quality $$$4$$$.  Response 5 has quality $$$1$$$. Among these responses, Response 4 has the highest quality.
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases.The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of responses.Then $$$n$$$ lines follow, the $$$i$$$-th of which contains two integers $$$a_i$$$ and $$$b_i$$$ ($$$1 \leq a_i, b_i \leq 50$$$) — the number of words and the quality of the $$$i$$$-th response, respectively. Additional constraints on the input: in each test case, at least one value of $$$i$$$ satisfies $$$a_i \leq 10$$$, and all values of $$$b_i$$$ are distinct.
For each test case, output a single line containing one integer $$$x$$$ ($$$1 \leq x \leq n$$$) — the winner of the show, according to the rules given in the statement.It can be shown that, according to the constraints in the statement, exactly one winner exists for each test case.
def find_winner(n, responses):
    max_quality = -1
    winner_index = -1
    for i in range(n):
        (words, quality) = responses[i]
        if words <= 10 and quality > max_quality:
            max_quality = quality
            winner_index = i + 1
    return winner_index
t = int(input())
for _ in range(t):
    n = int(input())
    responses = []
    for _ in range(n):
        (a, b) = map(int, input().split())
        responses.append((a, b))
    print(find_winner(n, responses))
t = eval(input())
for i in range(t):
    n = eval(input())
    ans = (0, 0)
    for j in range(n):
        (a, b) = map(int, input().split())
        if a <= 10 and b > ans[1]:
            ans = (j, b)
    print(ans[0] + 1)
t = int(input())
for i in range(t):
    n = int(input())
    result = 0
    max = 0
    for j in range(n):
        (a, b) = map(int, input().split())
        if a < 11 and b > max:
            result = j + 1
            max = b
    print(result)