#include<stdio.h>
#include<vector>
using namespace std;
vector<int> relations[100];
int bestLayer, bestNum;
void BFS(int layer, vector<int> parent)
{
int num = 0;
vector<int> child;
for (int i = 0; i < parent.size(); i++)
{
for (int j = 0; j < relations[parent[i]].size(); j++)
{
num++;
child.push_back(relations[parent[i]][j]);
}
}
if (num > bestNum)
{
bestLayer = layer;
bestNum = num;
}
if (child.empty() != true)
{
BFS(layer + 1, child);
}
}
int main()
{
bestLayer = 1;
bestNum = 1;
int N, M;
scanf("%d%d", &N, &M);
for (int i = 0; i < M; i++)
{
int parent, k;
scanf("%d %d", &parent, &k);
for (int j = 0; j < k; j++)
{
int child;
scanf("%d", &child);
relations[parent].push_back(child);
}
}
vector<int> parent;
parent.push_back(1);
BFS(2, parent);
printf("%d %d\n", bestNum, bestLayer);
return 0;
}