Help me in finding error in my code

Problem statement:

Here is my code of above problem. Help me to find test cases which are failing
My solution:
https://www.codechef.com/viewsolution/1024258442

@srishti34
For test case
1
3 4
2 1 4
2 1 3
2 2 3
your code output is all
but actual answer would be some.
cozz u can skip the 2nd island.

Oh, Okay
Thanks a lot

Not that case.
https://www.codechef.com/viewsolution/1024408031
The above code also gives output as “all” for the given test case but giving correct answer
1
3 4
2 1 4
2 1 3
2 2 3
Can you explain me?

@srishti34
may be they have not taken this case in the hidden test cases.
but u have to consider this condition in your code.
The code u have sent which is giving correct answer is not actually correct .
cozz for this case it has to be “some”.
This is my code in c++.
its absolutely correct .
Giving some for this case too.

#include <bits/stdc++.h>
#define ll long int
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--){
	    ll n,k;
	    cin>>n>>k;
	    ll flag=0;
	    map<ll,ll> mp;
	    vector<vector<int>> v;
	    for(int i=0;i<n;i++)
	    {
	        ll p;
	        cin>>p;
	        vector<int> val(p);
	        for(int j=0;j<p;j++)
	        {
	            cin>>val[j];
	            mp[val[j]]++;
	        }
	        v.push_back(val);
	    }
	   if(mp.size()!=k)
	   {
	       cout<<"sad";
	   }
	   else
	   {
	       for(int i=0;i<v.size();i++)
	       {
	           int ch=0;
	           for(int j=0;j<v[i].size();j++)
	           {
	               if(mp[v[i][j]]==1)
	               {
	                   ch=1;
	               }
	           }
	           if(!ch)
	           {
	               flag=1;
	           }
	       }
	       if(flag)
	       cout<<"some";
	       else
	       cout<<"all";
	   }
	   cout<<endl;
	}
	return 0;
}