#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

int main(){

	int n;
	while (std::cin >> n, n){

		std::vector<std::vector<int> >v(31);
		std::pair<int, std::string> res[21];

		for (int i = 0; i < 31; i++)v[i].clear();
		for (int i = 0; i < 21; i++)res[i].first = 0;

		for (int i = 0; i < n; i++){
			int m;
			std::cin >> res[i].second >> m;

			for (int j = 0; j < m; j++){
				int d;
				std::cin >> d;
				v[d].push_back(i);
			}
		}

		for (int i = 0; i < 31; i++){
			int point = n - (v[i].size() - 1);
			for (int j = 0; j < v[i].size(); j++){
				int id = v[i][j];
				res[id].first += point;
			}
		}

		std::sort(res, res + n);

		std::cout << res[0].first << " " << res[0].second << std::endl;

	}
	return 0;
}