#include <iostream>
#include <iomanip>
using namespace std;
double res(int *arr, int len) {
int min,max;
min = arr[0];
max = arr[0];
for(int i = 1; i < len; i++) {
if(arr[i] > max) {
max = arr[i];
}
if(arr[i]<min) {
min = arr[i];
}
}
int sum = 0;
int count = 0;
for(int i = 0; i < len; i++) {
if(arr[i] != max && arr[i] != min) {
sum += arr[i];
count++;
}
}
return sum/((double)count);
}
int main() {
int m, n;
cin >> n >> m;
cout << fixed << setprecision(2);
for(int i = 0; i < m; i++) {
int* arr = new int[n];
for(int j = 0 ; j < n; j++) {
cin >> arr[j];
}
cout << res(arr, n) << " ";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPiAKI2luY2x1ZGUgPGlvbWFuaXA+IAp1c2luZyBuYW1lc3BhY2Ugc3RkOyAKCmRvdWJsZSByZXMoaW50ICphcnIsIGludCBsZW4pIHsKCWludCBtaW4sbWF4OwoJbWluID0gYXJyWzBdOwoJbWF4ID0gYXJyWzBdOwoJZm9yKGludCBpID0gMTsgaSA8IGxlbjsgaSsrKSB7CgkJaWYoYXJyW2ldID4gbWF4KSB7CgkJCW1heCA9IGFycltpXTsKCQl9ICAgCgkJaWYoYXJyW2ldPG1pbikgewoJCQltaW4gPSBhcnJbaV07CgkJfQoJfQoJaW50IHN1bSA9IDA7CglpbnQgY291bnQgPSAwOwoJZm9yKGludCBpID0gMDsgaSA8IGxlbjsgaSsrKSB7CgkJaWYoYXJyW2ldICE9IG1heCAmJiBhcnJbaV0gIT0gbWluKSB7CgkJCXN1bSArPSBhcnJbaV07CgkJCWNvdW50Kys7CgkJCQkJCX0KCX0gIAoJcmV0dXJuIHN1bS8oKGRvdWJsZSljb3VudCk7CgkKfSAKCmludCBtYWluKCkgeyAgCglpbnQgbSwgbjsKCWNpbiA+PiBuID4+IG07Cgljb3V0IDw8IGZpeGVkIDw8IHNldHByZWNpc2lvbigyKTsKCWZvcihpbnQgaSA9IDA7IGkgPCBtOyBpKyspIHsKCQlpbnQqIGFyciA9IG5ldyBpbnRbbl07CgkJZm9yKGludCBqID0gMCA7IGogPCBuOyBqKyspIHsKCQkJY2luID4+IGFycltqXTsKCQl9CgkJY291dCA8PCByZXMoYXJyLCBuKSA8PCAiICI7Cgl9CglyZXR1cm4gMDsKfQ==