T = int(input())
def sol(n):
n = list(map(int,n.split()))
n.sort()
n = n[1:]
n = n[:-1]
return round(sum(n)/len(n))
for test_case in range(1, T + 1):
n = input()
print(f"#{test_case} {sol(n)}")
T = int(input())
def sol(n,m):
grade = ['A+','A0','A-','B+','B0','B-','C+','C0','C-','D0']
grade1 = {}
for i in range(n):
mid,fin,todo = map(int,input().split())
grade1[i] = 0.35*mid+0.45*fin+0.2*todo
g = sorted(grade1.items(),key = lambda x:-x[1])
g = dict(g)
k = 0 ; sub_k = 0
# return g
nn = n//10
for i in g.keys():
if i == m-1:
return grade[k]
sub_k += 1
if sub_k % nn == 0:
k += 1
for test_case in range(1, T + 1):
n,m = map(int,input().split()) #학생 수, 번째
print(f"#{test_case} {sol(n,m)}")
T = int(input())
def sol(n):
y,m,d = n[:4],int(n[4:6]),int(n[6:])
day_31 = [1,3,5,7,8,10,12]
day_30 = [4,6,9,11]
if m in day_31:
if 1 <= d <= 31:
date = y+'/'+n[4:6]+'/'+n[6:]
return date
else:
return -1
elif m == 2:
if 1 <= d <= 28:
date = y+'/'+n[4:6]+'/'+n[6:]
return date
else:
return -1
elif m in day_30:
if 1 <= d <= 30:
date = y+'/'+n[4:6]+'/'+n[6:]
return date
else:
return -1
else:
return -1
for test_case in range(1, T + 1):
n = input()
print(f"#{test_case} {sol(n)}")