#include using namespace std; typedef long long ll; typedef pair pii; #define fi first #define se second #define mp make_pair #define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll gen(ll m){ return ((ll)rng() % m + m) % m; } const int M = (int)1e6 + 9; ll xr[M]; set act[M]; ll f[M]; int main(){ fastIO; int n, m; cin >> n >> m; int k; vector, int>> a(n); for(int i = 0 ; i < n; i ++ ){ cin >> k; a[i].fi.resize(k); for(int j = 0 ;j < k ; j ++) { cin >> a[i].fi[j]; } a[i].se = i; } sort(a.begin(), a.end(), [&](auto &i, auto &j){ return i.fi.size() > j.fi.size(); }); for(int i = 0 ; i < n; i ++ ){ xr[i] = gen((ll)2e18); } for(int i = 0 ; i < n; i ++ ){ int i1 = -1, i2 = -1; for(auto x : a[i].fi){ if(i1 == -1){ i1=x; } else if(i2 == -1){ if(f[x]!=f[i1])i2=x; } } if(i2 != -1){ for(auto p : act[i1]){ if(!act[i2].count(p)){ cout << "YES\n" << a[i].se + 1 << " " << p + 1 << "\n"; return 0; } } for(auto p : act[i2]){ if(!act[i1].count(p)){ cout << "YES\n"; cout << a[i].se + 1 << " " << p + 1 << "\n"; return 0; } } return 0; } for(auto x : a[i].fi){ act[x].insert(a[i].se); f[x] ^= xr[a[i].se]; } } cout << "NO\n"; return 0; }