#include <bits/stdc++.h>
using namespace std;
int n, ans, ss[2100][70], x[2100], to[2100], bb[2100][70];
long long a[2100];
char S[2100];
int main() {
  scanf("%d", &n);
  for (int T = 1; T <= n; T++) {
    scanf("%s", S);
    int l = strlen(S);
    for (int j = 0; j <= 600; j++) a[j] = 0;
    for (int j = 0; j < l; j++) a[l - j] = S[j] - '0';
    for (int i = 0; i < 70; i++) {
      for (int j = l; j; j--) {
        a[j - 1] += (a[j] & ((1 << 31) - 1)) * 10;
        a[j] >>= 31;
      }
      ss[T][i] = a[0] / 10;
      a[0] = 0;
    }
    l = 2000;
    ans = 0;
    while (true) {
      while (l >= 0 && !(ss[T][l / 31] & (1 << (l % 31)))) l--;
      if (l < 0 || !to[l]) break;
      int p = to[l];
      x[++ans] = p;
      for (int i = 0; i < 70; i++) ss[T][i] ^= ss[p][i];
    }
    for (int i = 0; i < 70; i++) bb[T][i] = 0;
    for (int i = 1; i <= ans; i++) {
      int p = x[i];
      for (int j = 0; j < 70; j++) bb[T][j] ^= bb[p][j];
    }
    if (l < 0) {
      int l = 0;
      for (int i = 0; i < 2000; i++)
        if (bb[T][i / 31] & (1 << (i % 31))) l++;
      printf("%d ", l);
      for (int i = 0; i < 2000; i++)
        if (bb[T][i / 31] & (1 << (i % 31))) {
          l--;
          printf("%d", i - 1);
          if (l)
            printf(" ");
          else
            printf("\n");
        }
    } else {
      to[l] = T;
      bb[T][T / 31] |= (1 << (T % 31));
      printf("0\n");
    }
  }
}
