#include using namespace std; using ll=long long; //#define int ll #define rep(i,a,b) for(int i=a;i<(b);i++) #define sz(x) (int)(x).size() #define all(x) begin(x), end(x) using pii=pair; using vi=vector; #define fi first #define se second #define pb push_back signed main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); int n, m; cin >> n >> m; vector> a(n); for(auto &i : a) { int t; cin >> t; i.resize(t); for(auto &j : i) cin >> j; } vector ord(n); iota(all(ord), 0); sort(all(ord), [&](int x, int y) { return a[x].size() < a[y].size(); }); vector cnt(m + 1); auto test = [&](int x, int y) { int inter = 0; for(auto i : a[x]) cnt[i]++; for(auto i : a[y]) { inter += cnt[i]++; } for(auto i : a[x]) cnt[i]--; for(auto i : a[y]) cnt[i]--; // cout << x << " " << return inter < min(a[x].size(), a[y].size()) && inter; }; map check; for(auto i : ord) { vector todo; for(auto el : a[i]) { if(check.count(el)) { todo.push_back(check[el]); } } sort(all(todo)); todo.erase(unique(all(todo)), todo.end()); for(auto j : todo) { if(test(j, i)) { cout << "YES\n" << j + 1 << " " << i + 1 << endl; exit(0); } } for(auto el : a[i]) check[el] = i; } cout << "NO\n"; }