#include <stdio.h>


int main () {

	int dataset=0;
	int dataset_num=0;
	int input=0;
	int count=0;
	int number=1;
	int mul=1;

	int result1=0;
	int result2=0;
	char f_result=0;

	int point[100];
	int max=0;
	int cul=0;


	scanf("%d",&dataset);
	dataset_num = dataset;

	while( dataset != 0 ){
		count=0;

		while(1){
			scanf("%d",&point[count]);
			if(point[count] == 0 ){
				printf("input finish\n");
				break;
			}
			count++;
		}


		//??????????§?
		int i=0;
		int number;
		count--;
		max = count;

		//??¨?????????
		int tamesi=count;
		int x=0;
		while(1){
			printf("%d ",point[x] );
			x++;

			if(point[x]==0){
				printf("\ndisplay finish\n");
				break;
			}
		}
		//??¨??????????????????

		//?????????
		for(;count != 0 ;count--){
			for( i=0; i < count ;i++){

				if(point[i] < point[i+1]){
					number = point[i];
					point[i] = point[i+1];
					point[i+1] = number;
				}
			}
		}

		count=1;
		while(1){
			cul += point[count];
			count++;
			if(max == count){
				printf("cul fini\n");
				break;
			}
		}
		cul = cul / (max-1);

		printf("%d\n",cul );

		dataset--;
		input++;

	}
		


	return 0;
}