#include int main () { int l = 0; int a = 0; int res = 0; long long dp[1000000][2] = {}; int a_set[19] = {}; for (int i = 0; i < 19; i++) { res = scanf("%d", &l); for (int j = 0; j < l; j++) { res = scanf("%d", &a); a_set[i] |= (1<<(a-1)); } } dp[0][0] = 1LL; for (int i = 0; i < (1<<19)-1; i++) { int cnt = 0; int gt_num = 0; for (int j = 0; j < 19; j++) { if ((i&(1< 0) { cnt++; } } for (int j = 18; j >= 0; j--) { if ((i&(1< 0) { gt_num++; } else if ((a_set[cnt]&(1< 0) { int idx = (i|(1<