#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main() {
	int n;
	while(cin >> n && n) {
		map<string, int> p;
		int cnt[35];
		memset(cnt, 0, sizeof(cnt));

		string s[50];
		int m[50], d[50][50];
		rep(i, n) {
			cin >> s[i] >> m[i];

			rep(j, m[i]) {
				cin >> d[i][j];
				cnt[d[i][j]]++;
			}
		}

		rep(i, n) {
			rep(j, m[i]) {
				p[s[i]] += n - cnt[d[i][j]] + 1;
			}
		}

		int ans = INF;
		string res = "";
		rep(i, n) {
			if(ans > p[s[i]]) {
				ans = p[s[i]];
				res = s[i];
			} else if(ans == p[s[i]] && res > s[i]) {
				ans = p[s[i]];
				res = s[i];
			}
		}

		cout << ans << " " << res << endl;
	}

	return 0;
}