#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 10;
int ttt, n, a[N];
char str[N];
bitset<N> s[N], ss[N], t, sets;
int main() {
  cin >> ttt;
  for (int i = 0; i < ttt; i++) {
    scanf("%s", str);
    t = sets = 0;
    n = strlen(str) - 1;
    for (int i = 0; i <= n; i++) a[n - i] = str[i] - '0';
    for (int i = 0; i < N; i++) {
      int r = 0;
      for (int k = n; k >= 0; k--) a[k] += r * 10, r = (a[k] & 1), a[k] >>= 1;
      t[i] = r;
      for (; ~n && !a[n]; --n)
        ;
    }
    for (int k = 0; k < N; k++)
      if (t[k]) t ^= s[k], sets ^= ss[k];
    if (t == 0) {
      cout << sets.count() << " ";
      for (int t = 0; t < i; t++)
        if (sets[t]) printf("%d ", t);
    } else {
      putchar('0');
      sets[i] = 1;
      int l = 0;
      for (; !t[l]; l++)
        ;
      for (int k = 0; k < i; k++)
        if (s[k][l]) s[k] ^= t, ss[k] ^= sets;
      s[l] = t, ss[l] = sets;
    }
    puts("");
  }
}
