#include <bits/stdc++.h>
using namespace std;
void print(const bitset<2000>& bits) {
  for (int i = 0; i < int(bits.size()); ++i) {
    if (bits.test(i)) {
      ;
    }
  };
}
void readNumber(bitset<2000>& bits) {
  static char s[700];
  scanf("%s", s);
  int len = strlen(s);
  ;
  reverse(s, s + len);
  const int POW = 25;
  const int MOD = 1 << POW;
  for (int i = 0; !(len == 1 && s[0] == '0'); i += POW) {
    int rem = 0;
    for (int j = len - 1; j >= 0; --j) {
      rem = rem * 10 + (s[j] - '0');
      s[j] = '0' + (rem / MOD);
      rem %= MOD;
    }
    while (len > 1 && s[len - 1] == '0') {
      --len;
    }
    for (int j = 0; j < POW; ++j) {
      if (rem & (1 << j)) {
        bits.set(i + j);
        ;
      }
    };
  };
}
int main() {
  int n;
  scanf("%d", &n);
  vector<bitset<2000> > a;
  vector<bitset<2000> > ans;
  vector<int> col_num;
  for (int i = 0; i < n; ++i) {
    bitset<2000> newNum;
    readNumber(newNum);
    bitset<2000> comb;
    comb.set(i);
    for (int j = 0; j < int(a.size()); ++j) {
      if (newNum.test(col_num[j])) {
        newNum ^= a[j];
        comb ^= ans[j];
      }
    }
    if (newNum.any()) {
      a.push_back(newNum);
      ans.push_back(comb);
      int j = 0;
      while (!newNum.test(j)) {
        ++j;
      }
      col_num.push_back(j);
      printf("0\n");
    } else {
      printf("%d", int(comb.count()) - 1);
      for (int j = 0; j < i; ++j) {
        if (comb.test(j)) {
          printf(" %d", j);
        }
      }
      printf("\n");
    }
  }
  return 0;
}
