题目描述
Problem Background
A die is a regular hexahedron (cube), with each face displaying a number represented by dots (the number of dots indicates the value of the number). A standard die has six faces, each showing a different number from $1$ to $6$:

Problem Description
However, today you have obtained a special die where each face still shows a number between $1$ and $6$, but numbers on different faces may repeat. To determine the numbers on the die, you have taken multiple photos of the die from various angles using a camera (the die may be flipped in any direction in space). Due to the camera's angle limitations, each photo captures only three faces of the die.
You need to deduce the possible numbers on each face of the die based on the multiple photos taken by the camera.
Input Format
The first line of the input data contains an integer $n$, representing the number of times the camera has taken photos.
The next $n$ lines each contain three integers $x, y, z (1 \leq x, y, z \leq 6)$, representing the numbers on three faces of the die captured in one photo, as shown below:

The input data guarantees that all $x, y, z$ are from the same die.
Output Format
Output one line with two integers separated by a space, representing the minimum and maximum sums of the numbers on the die that satisfy the results captured by the camera.
Sample Input and Output
Sample Input #1
2
1 1 1
2 2 1
Sample Output #1
8 13
Sample Input #2
2
1 2 3
4 5 6
Sample Output #2
21 21
Notes
Sample Explanation
Sample #1
We know that the die has at least three $1$s and two $2$s. The remaining number could be either $1$ or $6$.
Sample #2
This is a "standard" die where the numbers $1$ to $6$ each appear exactly once.
For $20\%$ of the data, $0 \leq n \leq 1$.
For $100\%$ of the data, $0 \leq n \leq 20$.
The original full score for this problem was $20\text{pts}$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分