#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

const int INF = 1000000000;

int main()
{
	int n;
	while(cin >> n){
		if(!n)
			break;
		map<string,vector<int> > ttable;
		map<string,int> point;
		for(int i=0;i<n;i++){
			string str;
			int m;
			cin >> str;
			cin >> m;
			int t;
			for(int j=0;j<m;j++){
				cin >> t;
				ttable[str].push_back(t);
			}
			point[str] = INF;
		}
		
		for(int i=0;i<31;i++){
			int p = 1+n;
			for(map<string,vector<int> >::iterator it = ttable.begin();it != ttable.end();it++){
				for(vector<int>::iterator itt = it->second.begin();itt != it->second.end();itt++){
					if(i == *itt)
						p--;
				}
			}	
			for(map<string,vector<int> >::iterator it = ttable.begin();it != ttable.end();it++){
				for(vector<int>::iterator itt = it->second.begin();itt != it->second.end();itt++){
					if(i == *itt){
						if(point[it->first] == INF)
							point[it->first] = p;
						else
							point[it->first] += p;
					}
				}
			}	
		}

		map<string,int>::iterator it = point.begin();
		string nmemo = it->first;
		int pmemo = it->second;
		for(it;it != point.end();it++){
			if(it->second ==  INF)
				it->second = 0;
			if(it->second < pmemo){
				nmemo = it->first;
				pmemo = it->second;
			}
		}
		cout << pmemo << " " << nmemo << endl; 
	}
	return 0;
}