#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
using namespace std;
const int L = 150;
const int B = 100000;
const int LB = 5;
class Long {
 public:
  int m[L], l;
  int &operator[](int i) { return m[i]; }
  Long operator=(int x) {
    for (l = 1, m[l - 1] = x % B, x /= B; x; m[l++] = x % B, x /= B)
      ;
    return *this;
  }
  Long operator=(char *s) {
    int i, j, n;
    for (n = 0; s[n] >= '0' && s[n] <= '9'; n++)
      ;
    for (l = (n + LB - 1) / LB, i = 0; i < l; i++)
      for (m[i] = 0, j = 0; j < LB; j++)
        if (n - i * LB - LB + j >= 0)
          m[i] = m[i] * 10 + s[n - i * LB - LB + j] - '0';
    return *this;
  }
  bool inp() {
    char s[L * LB + 10];
    if (scanf("%s", s) == EOF)
      return 0;
    else {
      *this = s;
      return 1;
    }
  }
  void out() {
    int i;
    char s[8];
    for (sprintf(s, "%%0%dd", LB), printf("%d", m[l - 1]), i = l - 2; i >= 0;
         printf(s, m[i]), i--)
      ;
  }
};
bool operator<(Long x, Long y) {
  int i;
  if (x.l != y.l) return x.l < y.l;
  for (i = x.l - 1; i >= 0 && x[i] == y[i]; i--)
    ;
  return i >= 0 && x[i] < y[i];
}
Long operator+(Long x, Long y) {
  int i;
  long long h;
  for (h = 0, i = 0; i < x.l || i < y.l || h;
       h += (i < x.l) * x[i] + (i < y.l) * y[i], x[i] = h % B, h /= B, i++)
    ;
  x.l = i;
  return x;
}
Long operator-(Long x, Long y) {
  int i;
  long long h;
  for (h = 0, i = 0; i < x.l;
       h += x[i] - (i < y.l) * y[i] + B, x[i] = h % B, h /= B, h--, i++)
    ;
  for (; x.l > 1 && !x[x.l - 1]; x.l--)
    ;
  return x;
}
Long operator*(Long x, int y) {
  int i;
  long long h;
  for (h = 0, i = 0; i < x.l || h;
       h += (i < x.l) * (long long)x[i] * y, x[i] = h % B, h /= B, i++)
    ;
  for (x.l = i; x.l > 1 && !x[x.l - 1]; x.l--)
    ;
  return x;
}
Long operator/(Long x, int y) {
  int i;
  long long h;
  for (h = 0, i = x.l - 1; i >= 0; h = h * B + x[i], x[i] = h / y, h %= y, i--)
    ;
  for (; x.l > 1 && !x[x.l - 1]; x.l--)
    ;
  return x;
}
int operator%(Long x, int y) {
  int i;
  long long h;
  for (h = 0, i = x.l - 1; i >= 0; h = h * B + x[i], h %= y, i--)
    ;
  return h;
}
Long operator*(Long x, Long y) {
  int i, j;
  long long h;
  Long z;
  for (h = 0, z.l = x.l + y.l, i = 0; i < z.l; z[i] = h % B, h /= B, i++)
    for (j = i < x.l - 1 ? i : x.l - 1; j >= 0 && i - j < y.l;
         h += (long long)x[j] * y[i - j], j--)
      ;
  for (; z.l > 1 && !z[z.l - 1]; z.l--)
    ;
  return z;
}
Long operator/(Long x, Long y) {
  int i;
  Long h, t;
  if (y.l == 1) return x / y[0];
  for (h = 0, i = x.l - 1; i >= 0; h = h - y * x[i], i--)
    for (t = x[i], h = h * B + t,
        x[i] = ((h.l > y.l) * ((long long)h[h.l - 1] * B * B +
                               (long long)h[h.l - 2] * B + h[h.l - 3]) +
                (h.l == y.l) * ((long long)h[h.l - 1] * B + h[h.l - 2])) /
               ((long long)y[y.l - 1] * B + y[y.l - 2]);
         x[i] && h < y * x[i]; x[i]--)
      ;
  for (; x.l > 1 && !x[x.l - 1]; x.l--)
    ;
  return x;
}
Long operator%(Long x, Long y) {
  int i;
  Long h, t;
  if (y.l == 1) return h = x % y[0];
  for (h = 0, i = x.l - 1; i >= 0; h = h - y * x[i], i--)
    for (t = x[i], h = h * B + t,
        x[i] = ((h.l > y.l) * ((long long)h[h.l - 1] * B * B +
                               (long long)h[h.l - 2] * B + h[h.l - 3]) +
                (h.l == y.l) * ((long long)h[h.l - 1] * B + h[h.l - 2])) /
               ((long long)y[y.l - 1] * B + y[y.l - 2]);
         x[i] && h < y * x[i]; x[i]--)
      ;
  return h;
}
const int maxN = 2100;
int n;
Long a[maxN];
bitset<maxN> c[maxN], d[maxN];
void convert(Long a, bitset<maxN> &res) {
  int base = (1 << 16);
  vector<int> digits;
  Long zero;
  zero = 0;
  while (zero < a) {
    digits.push_back(a % base);
    a = a / base;
  }
  for (int i = 0; i < digits.size(); ++i) {
    for (int j = 0; j < 16; ++j) {
      if (digits[i] & (1 << j)) {
        res[i * 16 + j] = 1;
      }
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    a[i].inp();
    convert(a[i], c[i]);
    d[i][i] = 1;
  }
  const int maxL = 2000;
  vector<int> pos(maxL, -1);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < maxL; ++j) {
      if (pos[j] != -1 && c[i][j]) {
        c[i] ^= c[pos[j]];
        d[i] ^= d[pos[j]];
      }
    }
    for (int j = 0; j < maxL; ++j) {
      if (pos[j] == -1 && c[i][j]) {
        pos[j] = i;
        break;
      }
    }
    int cnt = c[i].count();
    if (cnt == 0) {
      printf("%d", (int)(d[i].count()) - 1);
      for (int j = 0; j < i; ++j) {
        if (d[i][j]) {
          printf(" %d", j);
        }
      }
      printf("\n");
    } else {
      printf("0\n");
    }
  }
  return 0;
}
