405480: GYM101972 F I'm Bored!

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

F. I'm Bored!time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Being a judge is not always an interesting job! For example, it is very boring to wait for the first submission in the contest. So, judges used to entertain themselves using the "I'm Bored" tab in the PC2 software. In this tab, a button is shown and you need to click it (if you can!).

Since Alaa has been a judge in many contests, the "I'm Bored" tab is also boring to her, so, she decided to play a new game in today's contest. Alaa brings with her a huge bag full of lowercase English letters, and she starts playing with them. Alaa goal is to build a list of palindrome strings of the same length such that each string does not contain the same character more than two times.

After 3 minutes of playing, Alaa wondered what is the longest string's length that she can build? And what is the maximum number of strings the list can contain? When Alaa brings her notebook to calculate the answers, she starts receiving dozens of submissions. So, she gives you her bag and asks you to find the answers for her. Can you?

Input

The first line contains an integer T (1 ≤ T ≤ 104) specifying the number of test cases.

Each test cases consists of a line containing 26 integers f1, ..., f26 (0 ≤ fi ≤ 109), in which fi is how many letters i Alaa has. The letters are numbered from 1 to 26 starting from 'a'.

Output

For each test case, print a single line containing two integers x and y, in which x is the length of the strings in the group and y is the size of the group.

ExampleInput
2
2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Output
4 1
4 2
Note

A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward, such as "madam" or "racecar".

加入题单

算法标签: