#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI acos(-1.0)
#define INF 10000000

typedef long long ll;

bool f[100];
string s, t;
vector<string> vs;
vector< vector<int> > vvi;

map<string, int> msi;

int n, m, d;

int main(){
	while (cin >> n){
		if (!n)break;
		REP(i, n){
			cin >> s >> m;
			vs.push_back(s);
			vector<int> vi;
			REP(j, m){
				cin >> d;
				vi.push_back(d);
			}
			vvi.push_back(vi);
		}
		REP(i, 30){
			int c = -1;
			REP(j, n){
				vector<int>::iterator it = find(ALL(vvi[j]), i);
				if (it != vvi[j].end()){
					msi[vs[j]] += n;
					f[j] = 1;
					c++;
				}
			}
			REP(j, n){
				if (f[j]){
					msi[vs[j]] -= c;
				}
				f[j] = 0;
			}
		}
		int mi = INF;
		REP(i, n){
			if (mi == msi[vs[i]]){
				if (t > vs[i]){
					t = vs[i];
				}
				continue;
			}
			if (mi != min(mi, msi[vs[i]])){
				t = vs[i];
				mi = min(mi, msi[vs[i]]);
			}
		}
		cout << mi << " " << t << endl;
		vs.clear();
		vvi.clear();
		msi.clear();
	}
}