#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long infLL = 0x3f3f3f3f3f3f3f3fLL;
const int maxn = 2000 + 5;
int n;
char s[maxn];
int num[maxn], mark[maxn];
bitset<maxn> data[maxn], from[maxn];
void construct(bitset<maxn> &mask, int &pos) {
  int len = strlen(s);
  for (int i = 0; i < (len); ++i) num[len - i - 1] = s[i] - '0';
  for (pos = 0; len; ++pos) {
    if (num[0] & 1) mask.set(pos);
    for (int j = len - 1, r = 0, t; j >= 0; --j, r = t) {
      t = num[j] % 2;
      num[j] = (num[j] + r * 10) / 2;
    }
    if (!num[len - 1]) --len;
  }
}
int main() {
  scanf("%d\n", &n);
  memset(mark, -1, sizeof(mark));
  for (int i = 0; i < (n); ++i) {
    gets(s);
    int pos;
    bitset<maxn> mask, indx;
    construct(mask, pos);
    indx.set(i);
    for (int j = pos - 1; j >= 0; --j)
      if (mask.test(j)) {
        if (mark[j] != -1) {
          mask ^= data[j];
          indx ^= from[j];
        } else {
          data[j] = mask;
          from[j] = indx;
          mark[j] = i;
          break;
        }
      }
    if (mask.any()) {
      puts("0");
    } else {
      printf("%d", (int)indx.count() - 1);
      for (int j = 0; j < (i); ++j)
        if (indx.test(j)) printf(" %d", j);
      puts("");
    }
  }
  return 0;
}
