#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long double pi = acos(-1.0);
const string debug_line = "yolo";
const long double PI = acos((long double)-1.0);
const long double eps = 1e-6;
unsigned long long getRand() {
  return ((unsigned long long)rand() << 40) +
         ((unsigned long long)rand() << 20) + ((unsigned long long)rand());
}
char s[610];
int arr[2010];
bitset<2010> v[2010], vv[2010], t, tt;
int p[2010];
void convertToBinary() {
  int n = strlen(s) - 1;
  for (int(i) = (0); (i) < (n + 1); ++(i)) {
    arr[i] = s[i] - '0';
  }
  for (int(i) = (0); (i) < (2010); ++(i)) {
    int rem = 0;
    for (int(j) = (n); (j) > (-1); --(j)) {
      arr[j] += rem * 10;
      rem = (int)(arr[j] & 1);
      arr[j] >>= 1;
    }
    t[i] = rem;
    while (n >= 0 && arr[n] == 0) {
      n--;
    }
  }
}
int main() {
  int m;
  scanf("%d", &m);
  for (int(i) = (0); (i) < (2010); ++(i)) p[i] = -1;
  for (int(index1) = (0); (index1) < (m); ++(index1)) {
    t = tt = 0;
    scanf("%s", s);
    reverse(s, s + (int)strlen(s));
    convertToBinary();
    for (int(i) = (0); (i) < (2010); ++(i)) {
      if (t[i]) {
        t ^= v[i];
        tt ^= vv[i];
      }
    }
    if (t == 0) {
      printf("%d ", (int)tt.count());
      for (int(i) = (0); (i) < (2010); ++(i)) {
        if (tt[i]) {
          printf("%d ", i);
        }
      }
      printf("\n");
    } else {
      printf("0\n");
    }
    tt[index1] = 1;
    if (t != 0) {
      int l1 = 0;
      while (t[l1] == 0) {
        l1++;
      }
      for (int(i) = (0); (i) < (2010); ++(i)) {
        if (v[i][l1] != 0) {
          v[i] ^= t;
          vv[i] ^= tt;
        }
      }
      v[l1] = t;
      vv[l1] = tt;
    }
  }
  return 0;
}
