Description
有 n 個角色,每個角色有攻擊力和防禦力,且每個角色的能力值相異。角色的能力值是攻擊力和防禦力的平方和。
請撰寫一支程式讓使用者輸入多個角色與他的能力值,輸出能力值第二大的攻擊力和防禦力數值。
There are n characters, each with attack and defense attributes, and each character has a unique ability value. The ability value of a character is the sum of the squares of its attack and defense attributes.
Please write a program that allows the user to input multiple characters along with their ability values, and output the second largest attack and defense values.
Input (From File: input.txt)
輸入第一行包含一個整數 n (3 ≤ n ≤ 20),表示有多少個角色。
接下來的 n 行,每行包含兩個整數 ��ai 和 ��di (1 ≤ ��ai, ��di ≤ 100),表示第 i 個角色的攻擊力和防禦力。
The first line of input contains an integer n (3 ≤ n ≤ 20), indicating the number of characters.
The next n lines each contain two integers��aiand��di(1 ≤��ai,��di≤ 100), representing the attack and defense attributes of the i-th character.
Output (To File: output.txt)
請輸出兩個整數,表示能力值第二大的角色的攻擊力和防禦力。
Output two integers representing the attack and defense values of the character with the second largest ability value.
Sample Input 1
3
3 1
5 2
1 4
Sample Output 1
1 4
Sample Input 2
5
34 35
84 32
39 79
59 89
59 31
Sample Output 2