// Aizu 2204: Final Examination!
// 2017.9.20 bal4u@uu

#include <stdio.h>

int main()
{
	int n, max, min, i, a, s;

	while (scanf("%d", &n) && n) {
		max = 0, min = 500;
		while (n-- > 0) {
			for (s = i = 0; i < 5; i++) scanf("%d", &a), s += a;
			if (s < min) min = s;
			if (s > max) max = s;
		}
		printf("%d %d\n", max, min);
	}
	return 0;
}