#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int SIZE = 2000;
unsigned long long d[SIZE][32], from[SIZE][32];
char s[SIZE];
int bit_cnt[1 << 16];
void myset(unsigned long long a[], int idx) {
  a[idx >> 6] |= (unsigned long long)1 << (idx & 63);
}
int myget(unsigned long long a[], int idx) {
  return (a[idx >> 6] >> (idx & 63)) & 1;
}
void mycopy(unsigned long long a[], unsigned long long b[]) {
  memcpy(a, b, sizeof(unsigned long long) * 32);
}
void myxor(unsigned long long a[], unsigned long long b[]) {
  for (int i = 0; i < (32); ++i) a[i] ^= b[i];
}
int mycount(unsigned long long a[]) {
  int res = 0;
  for (int i = 0; i < (32); ++i) {
    unsigned long long tmp = a[i];
    for (int j = 0; j < (4); ++j) {
      res += bit_cnt[tmp & 65535];
      tmp >>= 16;
    }
  }
  return res;
}
long long digit[300];
long long ten[9] = {1,      10,      100,      1000,     10000,
                    100000, 1000000, 10000000, 100000000};
long long input[100];
int main() {
  for (int i = (1); i < (1 << 16); ++i) {
    bit_cnt[i] = bit_cnt[i >> 1] + (i & 1);
  }
  int(n);
  scanf("%d", &n);
  vector<int> pre;
  for (int i = 0; i < (n); ++i) {
    scanf("%s", (s));
    int len = strlen(s);
    reverse(s, s + len);
    memset((digit), 0, sizeof((digit)));
    for (int j = 0; j < (len); ++j) digit[j >> 3] += (s[j] - '0') * ten[j & 7];
    int tail = (len + 10) / 8;
    while (!digit[tail]) tail--;
    unsigned long long me[32] = {}, me_from[32] = {};
    int idx = 0;
    while (tail > 0 || digit[0]) {
      for (int j = 0; j < (8); ++j)
        if ((digit[0] >> j) & 1) myset(me, idx + j);
      idx += 8;
      for (int j = tail; j > 0; j--) {
        digit[j - 1] += (digit[j] & 255) * ten[8];
        digit[j] >>= 8;
      }
      digit[0] >>= 8;
      while (tail > 0 && !digit[tail]) tail--;
    }
    bool suc = 1;
    for (int k = 0; k < (((int)(pre).size())); ++k) {
      int j = pre[k];
      if (myget(me, j)) {
        myxor(me, d[j]);
        myxor(me_from, from[j]);
      }
    }
    for (int j = 0; j < (SIZE); ++j) {
      if (myget(me, j)) {
        mycopy(d[j], me);
        mycopy(from[j], me_from);
        pre.push_back(j);
        myset(from[j], i);
        suc = 0;
        break;
      }
    }
    if (suc) {
      printf("%d", mycount(me_from));
      for (int j = 0; j < (SIZE); ++j)
        if (myget(me_from, j)) {
          printf(" %d", j);
        }
      puts("");
    } else {
      puts("0");
    }
  }
  return 0;
}
