#include <bits/stdc++.h>
using namespace std;
char s[1005];
int p[2005];
long long num[2005][45], Xor[2005][45], ans[45], val[45];
long long a[1005];
inline int bit(long long s, int p) { return (s >> p) & 1; }
inline int bit_count(long long x) {
  int res = 0;
  for (; x; x ^= x & -x) ++res;
  return res;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%s", s);
    int len = strlen(s);
    reverse(s, s + len);
    for (int j = 0; j < len; ++j) a[j] = s[j] - '0';
    int pos = 0;
    while (len) {
      long long c = 0;
      for (int j = len - 1; j >= 0; --j) {
        c *= 10;
        c += a[j];
        a[j] = c >> 50;
        c &= (1LL << 50) - 1;
      }
      num[i][pos++] = c;
      while (len && !a[len - 1]) --len;
    }
  }
  memset(p, -1, sizeof(p));
  for (int i = 0; i < n; ++i) {
    memset(ans, 0, sizeof(ans));
    memset(val, 0, sizeof(val));
    bool ok = 1;
    for (int j = 0; j <= 2000; ++j)
      if (bit(num[i][j / 50], j % 50) ^ bit(val[j / 50], j % 50)) {
        if (p[j] == -1) {
          ok = 0;
          break;
        }
        for (int k = 0; k <= 40; ++k)
          val[k] ^= num[p[j]][k], ans[k] ^= Xor[p[j]][k];
      }
    for (int k = 0; ok && k <= 40; ++k)
      if (num[i][k] ^ val[k]) ok = 0;
    if (!ok)
      puts("0");
    else {
      int sz = 0;
      for (int k = 0; k <= 40; ++k) sz += bit_count(ans[k]);
      printf("%d ", sz);
      for (int i = 0; i < n; ++i)
        if (bit(ans[i / 50], i % 50)) printf("%d ", i);
      puts("");
    }
    Xor[i][i / 50] |= 1LL << (i % 50);
    for (int j = 0; j <= 2000; ++j)
      if (p[j] != -1 && bit(num[i][j / 50], j % 50)) {
        for (int k = 0; k <= 40; ++k) num[i][k] ^= num[p[j]][k];
        for (int k = 0; k <= 40; ++k) Xor[i][k] ^= Xor[p[j]][k];
      }
    for (int j = 0; j <= 2000; ++j)
      if (bit(num[i][j / 50], j % 50)) {
        if (p[j] == -1) p[j] = i;
        break;
      }
  }
  return 0;
}
