LearnPy Hub
← Tuples & Sets problems
Hard

Union of Many

Read n, then n lines of integers. Print how many distinct values appear across all lines, and how many appear in every line.

Input

n, then n lines.

Output

Two numbers on one line.

Sample 1

Input
3
1 2 3
2 3 4
3 4 5
Output
5 1

Sample 2

Input
1
1 1 2
Output
2 2
solution.py
Output appears here
Union of Many · Python practice problem · LearnPy Hub