## P4906 小奔关闹钟(dfs)

// Problem: P4906 小奔关闹钟// Contest: Luogu// URL: https://www.luogu.com.cn/problem/P4906// Memory Limit: 125 MB// Time Limit: 5000 ms// Date: 2022-06-16 21:42:37// --------by Herio--------#include<bits/stdc++.h>using namespace std;typedef long long ll;typedef unsigned long long ull; const int N=1e3+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;const int hashmod[4] = {402653189,805306457,1610612741,998244353};#define mst(a,b) memset(a,b,sizeof a)#define db double#define PII pair<int,int>#define PLL pair<ll,ll>#define x first#define y second#define pb emplace_back#define SZ(a) (int)a.size()#define rep(i,a,b) for(int i=a;i<=b;++i)#define per(i,a,b) for(int i=a;i>=b;--i)#define IOS ios::sync_with_stdio(false),cin.tie(nullptr) void Print(int *a,int n){  for(int i=1;i<n;i++)    printf("%d ",a[i]);  printf("%d\n",a[n]); }template <typename T>   //x=max(x,y)  x=min(x,y)void cmx(T &x,T y){  if(x<y) x=y;}template <typename T>void cmn(T &x,T y){  if(x>y) x=y;}int n;int a[22][22];int f[22];int dfs(int x,int s){  if(x==n+1){    if(!s) return 0;    return inf;  }  return min(dfs(x+1,s),dfs(x+1,s^f[x])+1);}int main(){  scanf("%d",&n);  rep(i,1,n){    int t;scanf("%d",&t);    while(t--){      int x;scanf("%d",&x);      a[i][x]=1;    }  }      for(int i=1;i<=n;i++){      f[i]^=1<<(i-1);      for(int j=1;j<=n;j++){        if((i!=j) && a[i][j]){          f[i]^=1<<(j-1);          for(int k=1;k<=n;k++){            if((j!=k) && a[j][k])              f[i]^=1<<(k-1);          }        }      }    }  //for(int i=1;i<=n;i++) printf("%d\n",f[i]);  int ans = dfs(1,(1<<n)-1);  if(ans<inf) printf("%d\n",ans);  else puts("Change an alarm clock，please!");  return 0;}