#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 5000005;
int n, m, i, j, a[1005], d[1005], ans, f[1005], k, vi[1005][1005], c[1005][1005], l;
int dfs(int x) {
if (f[x]) return f[x];
for (int i = 1; i <= c[x][0]; i++) f[x] = max(f[x], dfs(c[x][i]));
return ++f[x];
}
int main() {
ios::sync_with_stdio(false);
}