#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e3 + 10;
char num[MAXN];
pair<string, int> now;
bitset<2010> a[MAXN], b[MAXN], X, ans;
int in[MAXN], cnt = 0, ad[MAXN];
int main() {
  fill(in, in + MAXN, -1);
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", num);
    int sz = strlen(num), id = 0;
    for (int j = 0; j < sz; j++) ad[j] = num[sz - 1 - j] - '0';
    while (sz > 0) {
      int rem = 0;
      for (int j = sz - 1; j > -1; j--) {
        ad[j] = rem * 10 + ad[j];
        rem = (ad[j] & 1);
        ad[j] >>= 1;
      }
      while (sz > 0 and ad[sz - 1] == 0) sz--;
      a[i][id] = rem;
      id++;
    }
    b[i][i] = 1;
  }
  for (int i = 0; i < n; i++) {
    X = a[i];
    ans = 0;
    bool is = true;
    for (int j = MAXN - 1; j > -1; j--) {
      if (X[j] == 1) {
        if (in[j] == -1) {
          is = false;
        } else {
          X ^= a[in[j]];
          ans ^= b[in[j]];
        }
      }
    }
    if (is == false)
      printf("0");
    else {
      printf("%d ", int(ans.count()));
      for (int j = 0; j < MAXN; j++)
        if (ans[j]) printf("%d ", j);
    }
    printf("\n");
    a[i] = X;
    b[i] ^= ans;
    if (a[i].count()) {
      int ind = 0;
      for (int j = MAXN - 1; j > -1; j--) {
        if (a[i][j] == 1) {
          ind = j;
          break;
        }
      }
      for (int j = 0; j < i - 1; j++) {
        if (a[j][ind]) {
          a[j] ^= a[i];
          b[j] ^= b[i];
        }
      }
      in[ind] = i;
    }
  }
  return 0;
}
