#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
const int N = 2010;
bitset<N> base[N], d, sel, Sel[N];
bool bs[N];
string p;
int n, a[N];
void trans(string p) {
  d = 0;
  int l = ((int)(p).size()) / 8 + 1;
  reverse((p).begin(), (p).end());
  while (((int)(p).size()) <= 8 * l) p.push_back('0');
  for (int i = 0; i < l; i++) {
    a[i] = 0;
    for (int j = 8 - 1; 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 - 1; 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() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    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("");
    }
  }
}
