#include <bits/stdc++.h>
using namespace std;
const int N = 2500;
int n, num[N], l, mx;
int ans[N], isfree[N], id[N];
char s[N];
bitset<N> a[N];
void work(int k, int n) {
  int m = n;
  for (; n % 8; n++)
    ;
  int t = 0;
  for (int i = n; i >= 0; i--) {
    if (i > m) continue;
    if (i != n && i % 8 == 0) {
      num[i / 8 + 1] = t;
      t = 0;
    }
    if (i == 0) break;
    t = t * 10 + s[m - i] - '0';
  }
  n /= 8;
  int pos = 0;
  while (n) {
    int now = 0;
    for (int i = n; i >= 1; i--) {
      now = now * (int)1e8 + num[i];
      num[i] = now / 2;
      now %= 2;
    }
    if (num[n] == 0) n--;
    a[++pos][k] = now;
    if (pos > mx) mx = pos;
  }
}
void print() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      printf("%d", (int)a[i][j]);
    }
    printf("\n");
  }
}
void Gauss() {
  bitset<N> t;
  memset(isfree, 0, sizeof(isfree));
  for (int i = 1, pos = 1; pos <= n; pos++) {
    int k = 0;
    for (int j = i; j <= mx; j++)
      if (a[j][pos]) {
        k = j;
        break;
      }
    if (k == 0) {
      isfree[pos] = i;
      continue;
    }
    id[i] = pos;
    t = a[i];
    a[i] = a[k];
    a[k] = t;
    for (int j = 1; j <= mx; j++) {
      if (j == i) continue;
      if (a[j][pos]) a[j] = a[j] ^ a[i];
    }
    i++;
  }
}
void solve() {
  for (int i = 1; i <= n; i++) {
    if (!isfree[i]) {
      printf("0\n");
    } else {
      int t = 0;
      for (int j = isfree[i] - 1; j >= 1; j--)
        if (a[j][i] == 1 && !isfree[id[j]]) {
          ans[++t] = id[j];
        }
      printf("%d", t);
      for (int j = t; j >= 1; j--) printf(" %d", ans[j] - 1);
      printf("\n");
    }
  }
}
int main() {
  scanf("%d", &n);
  mx = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%s", s);
    work(i, strlen(s));
  }
  Gauss();
  solve();
}
