#pragma GCC optimize "O3" #include using namespace std; using LL=long long; #define FOR(i,l,r) for(int i=(l);i<=(r);++i) #define REP(i,n) FOR(i,0,(n)-1) #define ssize(x) int(x.size()) #ifdef DEBUG auto&operator<<(auto&o,pairp){return o<<"("<decltype(x.end(),o){o<<"{";int i=0;for(auto e:x)o<<","+!i++<sync_with_stdio(0); int n, m; cin >> n >> m; vector>> input(n); REP(i, n) { input[i].first = i; auto &v = input[i].second; int ki; cin >> ki; v.resize(ki); for(int &x : v) { cin >> x; --x; } } debug(n, m, input); sort(input.begin(), input.end(), [&](const pair> &l, const pair> &r) { return ssize(l.second) < ssize(r.second); }); debug(input); auto ans = [&](int i, int j) { cout << "YES\n"; assert(i != j and 0 <= min(i, j) and max(i, j) < n); cout << input[i].first + 1 << ' ' << input[j].first + 1 << '\n'; exit(0); }; vector which_set(m, -1); REP(i, n) { map intersect_cnt; for(int x : input[i].second) if(which_set[x] != -1) intersect_cnt[which_set[x]] += 1; for(auto [prev, cnt] : intersect_cnt) if(cnt != ssize(input[prev].second)) { debug(i, prev, cnt, ssize(input[prev].second)); ans(i, prev); } for(int x : input[i].second) which_set[x] = i; } cout << "NO\n"; }