#include <bits/stdc++.h>
using namespace std;
char s[614];
long long int p10[10];
int m;
long long int r10[100];
long long int n10[100];
void mxor(long long int* a, long long int* b) {
  for (int i = 0; i < 150; i++) {
    a[i] ^= b[i];
  }
}
int lowbit(long long int k) {
  if (k == 0) return 7122;
  for (int i = 0;; i++) {
    if (k & 1) return i;
    k /= 2;
  }
  return 7122;
}
long long int r[2015][150];
int spb[2015];
int rt;
int ab[2015], abt;
void sol() {
  scanf("%d", &m);
  rt = 0;
  for (int i = 0; i < m; i++) {
    scanf("%s", s);
    for (int j = 0; j < 100; j++) r10[j] = 0;
    int sl = 0;
    for (; s[sl]; sl++)
      ;
    long long int t = 0;
    for (int j = sl - 1, c = 0; j >= 0; j--, c++) {
      t += (s[j] - '0') * p10[c & 7];
      if ((c & 7) == 7 || j == 0) {
        r10[c / 8] = t;
        t = 0;
      }
    }
    for (int k = 0; k < 150 / 2; k++) {
      t = 0;
      for (int j = 99; j >= 0; j--) {
        t = t * p10[8] + r10[j];
        n10[j] = t >> 30;
        t %= (1 << 30);
      }
      r[rt][k] = t;
      memcpy(r10, n10, sizeof(r10));
    }
    for (int k = 150 / 2; k < 150; k++) r[rt][k] = 0;
    r[rt][i / 30 + 150 / 2] = 1ll << (i % 30);
    for (int k = 0; k < rt; k++) {
      int b = spb[k];
      if ((r[rt][b / 30] >> (b % 30)) & 1) {
        mxor(r[rt], r[k]);
      }
    }
    int flag = 0;
    for (int k = 0; k < 150 / 2; k++) {
      if (r[rt][k] != 0) {
        flag = (k * 30 + lowbit(r[rt][k])) + 1;
        break;
      }
    }
    if (flag) {
      int b = spb[rt] = (--flag);
      for (int k = 0; k < rt; k++) {
        if ((r[k][b / 30] >> (b % 30)) & 1) {
          mxor(r[k], r[rt]);
        }
      }
      printf("0\n");
      rt++;
    } else {
      abt = 0;
      for (int k = 0; k < i; k++) {
        if ((r[rt][k / 30 + 150 / 2] >> (k % 30)) & 1) {
          ab[abt++] = k;
        }
      }
      printf("%d", abt);
      for (int k = 0; k < abt; k++) {
        printf(" %d", ab[k]);
      }
      puts("");
    }
  }
}
int main() {
  p10[0] = 1;
  for (int i = 1; i < 10; i++) p10[i] = p10[i - 1] * 10ll;
  while (1) {
    sol();
    break;
  }
  return 0;
}
