Under siege by the Greek army, the Trojans are desperately trying todefend their city from invasion. After each battle (which lasts manyhours), the two sides count their dead. The Trojans use these numbersto determine how many new warriors to recruit for the next day's battle.However, because there are so many dead, the reports from differentsources are inconsistent. Lacking formal mathematics education, theTrojan military leader is unable to find the average. Instead, he takes thethree numbers given to him by his three generals and finds themedian—that is, the number in between the other two.
Assumptions
The value for n will not exceed 1000.
The values for a b c each will be between 0 and 999999999, inclusive.
The values for a b and c are not exclusive; a b and c may containduplicate values.
All input will be valid.
Assumptions
The value for n will not exceed 1000.
The values for a b c each will be between 0 and 999999999, inclusive.
The values for a b and c are not exclusive; a b and c may containduplicate values.
All input will be valid.
Input Format
The first line of the input is an integer n that represents the number of data collections that follow where each data collection lies on a single line of input. Each line contains three integers a b c, each separated by a single space.
Sample Input
3
6 6 7
1582 1234 1337
6153 6214 10252
Output Format
Your program should produce n lines of output (one for each data collection). Each line should contain a single integer d, corresponding to the median of a, b, and c. Note that the value of d will always be one of either a, b or c.
The output is to be formatted exactly like that for the sample output given below.
Sample Output
6
1337
6214
You must be logged in to submit a solution.