n,k,m=map(int,input().split())
list2=[]
for i in range(n):
list1=list(map(int,input().split()))
fen=(sum(list1)-max(list1)-min(list1))/(k-2)
list2.append(fen)
list2.sort(reverse=True)
# print(fen)
#print(list2)
for i in range(m-1,0,-1):
print("{:.3f}".format(list2[i]),end=" ")
print("{:.3f}".format(list2[0]))