C program to find the index of third smallest number

Your college is organising a sporting event. The events are all done and now the task is to prepare the list of medal winners. The sports secretary for some reason assumed that the events will only have Gold and Silver medals but no Bronze medals. The contestants, especially the 3rd place winners were furious (understandably so!). To get things in control the secretary gives you the list of participants in an event and their standing in the event. Your task is to output the list of Bronze medalists in each of the events.

Each event has 10 participants.

Input:  The number of test cases T followed by T lines. Each line has  10 numbers that indicate the time taken by each contestant to complete the task. Each task takes less than or equal to 30 seconds. If there are two bronze winners, print the one with the lower id.

Output: The id of the contestant who secured the Bronze medal.

Example:

Input

1

16 12 34 11 10 5 3 1 15 21

Output

6

Explanation: The 1 in first line indicates that there is only one testcase. The third position is for the player who took 5 sec to finish the task. The player is in the 6th person in the input list. Note that the ids start at 1 and not at 0.

Implementation: