Three numbers A, B and C are the inputs. Write a program to find second largest among them.

-----Input-----

The first line contains an integer T, the total number of testcases. Then T lines follow, each line contains three integers A, B and C. 

-----Output-----
For each test case, display the second largest among A, B and C, in a new line.

-----Constraints-----
- 1 ≤ T ≤ 1000
- 1 ≤ A,B,C ≤ 1000000

-----Example-----
Input
3 
120 11 400
10213 312 10
10 3 450

Output

120
312
10

Starter code:

Solutions:
# cook your dish here
x=int(input())
for i in range(x):
    s=list(map(int,input().split()))
    s.sort()
    print(s[1])
    
    


for i in range(int(input())):
    a=list(map(int, input().split()))
    a.sort()
    print(a[1])

n= int(input())
for i in range(n):
    a,b,c= list(map(int,input().split()))
    if (a>b and b>c) or (c>b and b>a):
        print(b)
    elif (b>a and a>c) or (c>a and a>b):
        print(a)
    elif (b>c and c>a) or (a>c and c>b):
        print(c)


a=int(input(""))
A=[]
for m in range(a):
    x, y, z=[int(q) for q in input("").split()]
    B=[x,y,z]
    A.append(B)
for m in range(a):
    A1=max(A[m])
    A[m].remove(A1)
    A2=max(A[m])
    print(A2) 

a=int(input(""))
A=[]
for m in range(a):
    x, y, z=[int(q) for q in input("").split()]
    B=[x,y,z]
    A.append(B)
for m in range(a):
    A1=max(A[m])
    A[m].remove(A1)
    A2=max(A[m])
    print(A2) 

# cook your dish here
n = int(input())
while n>0:
    a = list(map(int,input().strip().split()))
    a.sort()
    print(a[1])
    n = n-1

# cook your dish here
t=int(input())
for i in range(0,t):
    x=[]
    a,b,c=list(map(int,input().split()))
    x=[a,b,c]
    x=sorted(x)
    print(x[1])
    
    
    


        
    
    
    


n=int(input())
for i in range(n):
    a=list(map(int,input().split()))
    a.sort()
    print(a[1])



for _ in range(int(input())):
    n=list(map(int,input().split()))
    l=len(n)
    a=sorted(n)
    print(a[l-2])


# cook your dish here
def get_input():
    s = []
    a,b,c = list(map(int,input().split()))
    s.append(a)
    s.append(b)
    s.append(c)
    s.sort()
    print(s[1])

n = int(input())
for i in range(n):
    get_input()


# cook your dish here
def get_input():
    s = []
    a,b,c = list(map(int,input().split()))
    s.append(a)
    s.append(b)
    s.append(c)
    s.sort()
    print(s[1])

n = int(input())
for i in range(n):
    get_input()


# cook your dish here
try:
    t=int(input())
    for i in range(0,t):
        l=[]
        a,b,c=map(int,input().split())
        l.append(a)
        l.append(b)
        l.append(c)
        w=max(l)
        l.remove(w)
        w=max(l)
        print(w)
except:pass

t=int(input())
i=0
while i<t:
    i=i+1 
    a,b,c=list(map(int, input().split()))
    
    if a>b and a>c:
        if b>c:
            print(b)
        else:
            print(c)
            
    elif b>c and b>a:
        if a>c:
            print(a)
        else:
            print(c)
            
    elif a>b:
        print(a)
    else:
        print(b)


# cook your dish here
x=int(input())
for i in range(x):
    lst=[int(item) for item in input().split()]
    lst.sort()
    print(lst[-2])

t=int(input())
for i in range(t):
    (x,y,z)=list(map(int, input().split()))
    if (x>y and x<z) or (x>z and x<y):
        print(x)
    elif (y>x and y<z) or (y>z and y<x):
        print(y)
    else:
        print(z)# cook your dish here


# cook your dish here
t=int(input())
for i in range(t):
    a,b,c=list(map(int,input().split(" ")))
    if(a>b>c or c>b>a):
        print(b)
    elif(b>a>c or c>a>b):
        print(a)
    else:
        print(c)
    
            
        


for _ in range (int(input())):
    a = list(map(int,input().split()))
    a.sort()
    print(a[1])

for t in range(int(input())):
    list1=list(map(int, input().split()))
    list1.sort()
    print(list1[-2])

# cook your dish here
t = int(input())
while t:
    t-=1
    a, b, c = list(map(int, input().split()))
    if (a>b and a<c) or (a>c and a<b):
        print(a)
    elif (b>a and b<c) or (b>c and b<a):
        print(b)
    elif (c>a and c<b) or (c>b and c<a):
        print(c)
    elif a==b or a==c:
        print(a)
    elif b==c:
        print(b)


T = int(input())
for i in range(T):
    A, B, C = (map(int, input().split()))
    l = [A, B, C]
    l.sort()
    print(l[1])

T = int(input())
for tc in range(T):
# Read integers a, b and c.
    (a, b, c) = map(int, input().split(' '))
    if (a>b and a<c) or (a>c and a<b) :
        print(a)
    elif (b>a and b<c) or  (b>c and b<a) :
        print(b)
    else:
        print(c)

#to find the second largest number from given 3 number

n = int(input())
for _ in range(n):
    input_list = input().split(" ")
    input_list = [int(x) for x in input_list]
    input_list.sort()
    print(input_list[1])


# cook your dish here
t=int(input())
for cases in range(t):
    a,b,c=list(map(int,input().split()))
    if c>b and c>a:
        if b>a:
            print(b)
        else:
            print(a)
    elif b>c and b>a:
        if c>a:
            print(c)
        else:
            print(a)
    else:
        if b>c:
            print(b)
        else:
            print(c)
    print()


# cook your dish here

t = int(input())

for i in range(t):
    a,b,c = map(int,input().split())
    li = [a,b,c]
    li.sort()
    print(li[1])

# cook your dish here
t=int(input())
while t>0:
    a,b,c=map(int,input().split())
    l=[a,b,c]
    l.sort()
    print(l[1])
    t-=1