#include <bits/stdc++.h>
using namespace std;
const int N = 2010;
bitset<N> base[N], d, sel, Sel[N];
bool bs[N];
int n, a[N];
void trans(string p) {
  d = 0;
  int l = p.size() / 8 + 1;
  reverse(p.begin(), p.end());
  while (p.size() < 8 * l) p.push_back('0');
  for (int i = 0; i < l; i++) {
    a[i] = 0;
    for (int j = 7; j >= 0; j--) {
      a[i] = a[i] * 10 + p[8 * i + j] - '0';
    }
  }
  long long s = 0;
  int tot = 0;
  while (l) {
    s = 0;
    for (int i = l; i >= 0; i--) {
      s = s * 100000000 + a[i];
      a[i] = s >> 32;
      s = s % (1LL << 32);
    }
    for (int i = 0; i < 32; i++) d[tot++] = (s >> i) & 1;
    while (l && a[l - 1] == 0) l--;
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    string p;
    cin >> p;
    trans(p);
    sel = 0;
    bool sol = 0;
    for (int k = 2000; k >= 0; k--) {
      if (d[k]) {
        if (bs[k]) {
          d = d ^ base[k];
          sel ^= Sel[k];
        } else {
          sol = 1;
          sel[i].flip();
          bs[k] = 1;
          base[k] = d;
          Sel[k] = sel;
          break;
        }
      }
    }
    if (sol)
      puts("0");
    else {
      int cnt = 0;
      for (int j = 0; j < i; j++) {
        if (sel[j]) cnt++;
      }
      printf("%d", cnt);
      for (int j = 0; j < i; j++)
        if (sel[j]) printf(" %d", j);
      puts("");
    }
  }
  return 0;
}
