#include <stdio.h> #define MAXN 1001 int main() { int zan[MAXN]; int N, K, F, i, j; int maxz, maxi; scanf("%d", &N); for (i=0; i<MAXN; i++) zan[i] = 0; for (i=0; i<N; i++) { scanf("%d", &K); for (j=0; j<K; j++) { scanf("%d", &F); zan[F]++; } } maxz = zan[MAXN-1]; maxi = MAXN-1; for (i=MAXN-2; i>0; i--) if (zan[i]>maxz) {maxz = zan[i]; maxi = i;} printf("%d %d\n", maxi, maxz); return 0; }