#include#include#include#includeusingnamespacestd;#definere(i, n) for (int i=0; i=0; i–)#definerre1(i, n) for (int i=n; i>0; i–)#definerre2(i, r, l) for (int i=r-1; i>=l; i–)#definerre3(i, r, l) for (int i=r; i>=l; i–)#definell long longconstintMAXN=2005, KS=32, MAXN0=(MAXN+1)/KS+1, INF=~0U>>2;intn, n0, q, A[MAXN][MAXN0], B[MAXN];boolC[MAXN], res[MAXN], res_ex=1;voidinit()
{
freopen(“arc.in”,”r”, stdin);intq0=0, q1=0, x, y, _q0, _q1;
scanf(“%d”,&n); n0=n/KS; q=n%KS;
re(i, n) {
scanf(“%d”,&x);if(x&1) {A[i][q0]|=1<
re(j, x) {
scanf(“%d”,&y); y–; _q0=y/KS; _q1=y%KS;
A[i][_q0]|=1<<_q1>
}if(q1==KS-1) {q0++; q1=0;}elseq1++;
}
fclose(stdin);
}voidsolve()
{
re(i, n) B[i]=-1;intq0, q1, x;
re(i, n) {
q0=q1=0;
re(j, n) {if(A[i][q0]&(1<
x=B[j];if(x==-1) {B[j]=i;break;}elsere3(k, q0, n0) A[i][k]^=A[x][k];
}if(q1==KS-1) {q0++; q1=0;}elseq1++;
}
}
q0=n0; q1=q;
rre(i, n) {if(q1) q1–;else{q0–; q1=KS-1;}if((x=B[i])>=0) {
res[i]=A[x][n0]&(1<
re(j, n)if(j!=x&&(A[j][q0]&(1<
A[j][q0]^=A[x][q0];if(q0
}
}else{
res[i]=1;
re(j, n)if(A[j][q0]&(1<
A[j][q0]&=~(1<
}
}
}
re(i, n)if((x=B[i])>=0) C[x]=1;
re(i, n)if(!C[i]&&(A[i][n0]&(1<
}voidpri()
{
freopen(“arc.out”,”w”, stdout);if(res_ex) {intsum=0;boolSPC=0; re(i, n)if(!res[i]) sum++;
printf(“%d\n”, sum);
re(i, n)if(!res[i]) {if(SPC) putchar(”);elseSPC=1;
printf(“%d”, i+1);
}
puts(“”);
}elseputs(“Impossible”);
fclose(stdout);
}intmain()
{
init();
solve();
pri();return0;
}