#include using namespace std; typedef long long int ll; typedef unsigned long long ull; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll myRand(ll B) { return (ull)rng() % B; } constexpr ll mod=1e9+7; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n,m; cin >> n >> m; vector> basis; for(int i=0;i> a; ll u=0; while(a--){ int b; cin >> b; b--; u+=(1LL<> y; for(auto e:basis){ ll uu=(u^e.first); if(u>uu){ u=uu; y^=e.second; } } if(u>0){ basis.push_back({u,y}); } else{ if(y!=0){ printf("-1\n"); return 0; } } } sort(basis.begin(), basis.end()); vector res(n,-1); for(auto e:basis){ for(int i=n-1;i>=0;i--){ if((1LL<=0;j--){ if((1LL<