import std.stdio;
import std.array;
import std.string;
import std.algorithm;
import std.conv;

void main() {
    int n;
    while (readf("%d\n", &n), n) {
        string[] index = new string[n];
        bool[][] table = new bool[][n];
        int x = 0;
        int[string] point;
        foreach (i; 0 .. n) {
            string name;
            readf("%s ", &name);
            index[x] = name;
            table[x] = new bool[31];
            foreach (d; readln.chomp.split(" ").map!(to!int).array[1 .. $]) {
                table[x][d] = true;
            }
            x++;
        }
        foreach (i; 0 .. n) {
            point[index[i]] = 0;
        }
        foreach (d; 0 .. 31) {
            int c = 0;
            foreach (i; 0 .. n) {
                c += table[i][d];
            }
            foreach (i; 0 .. n) {
                if (table[i][d]) {
                    point[index[i]] = point.get(index[i], 0) + (n - c + 1);
                }
            }
        }
        int minPoint = int.max;
        string minName;
        foreach (k, v; point) {
            if (minPoint > v) {
                minPoint = v;
                minName = k;
            }
        }
        writeln(minPoint, " ", minName);
    }
}