#include <bits/stdc++.h>
using namespace std;
int N;
int V[2002][65], what[2002][65], sizeV;
int sign[2002], pos[2002];
int now[65], mask[65];
int A[2002], B[2002];
inline bool isempty(int A[]) {
  for (int i = 0; i < 64; ++i)
    if (A[i] != 0) return false;
  return true;
}
inline int getelem(int A[], int pos) {
  return (A[pos / 32] & (1 << (pos % 32))) != 0;
}
inline void xorelem(int A[], int pos) { A[pos / 32] ^= (1 << (pos % 32)); }
inline void doxor(int A[], int B[]) {
  for (int i = 0; i < 64; ++i) A[i] ^= B[i];
}
inline void imp(int x) {
  int rem = 0;
  for (int i = A[0]; i >= 1; --i) {
    rem = rem * 10 + A[i];
    A[i] = rem / x;
    rem -= x * (rem / x);
  }
  while (A[0] != 0 && A[A[0]] == 0) --A[0];
}
inline bool compare(const int& i1, const int& i2) {
  return sign[i1] > sign[i2];
}
int main() {
  scanf("%d", &N);
  char saux[602];
  for (int i = 1; i <= N; ++i) {
    scanf("%s", saux);
    int sz = strlen(saux);
    for (int j = sz - 1; j >= 0; --j) A[++A[0]] = saux[j] - '0';
    memset(now, 0, sizeof(now));
    int done = 0;
    while (A[0] != 0) {
      int temp = 0;
      for (int j = min(A[0], 8); j >= 1; --j) temp = temp * 10 + A[j];
      for (int j = 0; j < 8; ++j, ++done)
        if (temp & (1 << j)) xorelem(now, done);
      imp(256);
    }
    memset(mask, 0, sizeof(mask));
    for (int j = 0; j < sizeV; ++j)
      if (getelem(now, sign[pos[j]])) {
        doxor(now, V[pos[j]]);
        doxor(mask, what[pos[j]]);
      }
    if (!isempty(now)) {
      int pp = -1;
      for (int j = 2000; j >= 0; --j)
        if (getelem(now, j)) {
          pp = j;
          break;
        }
      ++sizeV;
      xorelem(mask, i - 1);
      memcpy(V[sizeV - 1], now, sizeof(V[sizeV - 1]));
      memcpy(what[sizeV - 1], mask, sizeof(what[sizeV - 1]));
      sign[sizeV - 1] = pp;
      pos[sizeV - 1] = sizeV - 1;
      sort(pos, pos + sizeV, compare);
      printf("0\n");
    } else {
      int total = 0;
      for (int j = 0; j < N; ++j)
        if (getelem(mask, j)) ++total;
      printf("%d ", total);
      for (int j = 0; j < N; ++j)
        if (getelem(mask, j)) printf("%d ", j);
      printf("\n");
    }
  }
}
