# CodeChef - Second Largest

Second Largest from CodeChef

**Problem**

Three numbers ** A**,

**and**

`B`

**are the inputs. Write a program to find the second largest among them.**

`C`

**Input**

The first line contains an integer ** T**, the total number of test cases. The

**lines follow, each line contains three integers**

`T`

**,**

`A`

**and**

`B`

**.**

`C`

**Output Format**

For each test case, display the second largest among ** A**,

**and**

`B`

**, in a new line.**

`C`

**Constraints**

- 1 <= T <= 1000
- 1 <= A, B, C <= 1000000

## Solution in Java

```
import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef2{
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int t=in.nextInt();
int num[]=new int[3];
while(t-- >0){
for(int i=0;i<num.length;i++){
num[i]=in.nextInt();
}
Arrays.sort(num);
System.out.println(num[num.length-2]);
}
in.close();
}
}
```