#include <bits/stdc++.h>
using namespace std;
char s[2055];
int tmp[2055];
bitset<2055> now, rzz, use[2055], base[2055];
bool exist[2055];
int n;
void read() {
  scanf("%s", s + 1);
  int L = strlen(s + 1), m = 0, l = 1;
  for (int i = 1; i <= L; i++)
    if (i > L - i + 1) swap(s[i], s[L - i + 1]);
  for (int i = 1; i <= L; i += 7) {
    tmp[++m] = 0;
    for (int j = 7; j >= 1; j--)
      if (i + j - 1 <= L) tmp[m] = tmp[m] * 10 + s[i + j - 1] - '0';
  }
  L = m;
  m = 0;
  for (int i = 1; i <= L; i++)
    if (i > L - i + 1) swap(tmp[i], tmp[L - i + 1]);
  now.reset();
  while (1) {
    now[m++] = (tmp[L] & 1);
    int ret = 0;
    for (int j = l; j <= L; j++) {
      ret = ret * 10000000 + tmp[j];
      tmp[j] = ret / 2;
      ret %= 2;
    }
    bool flag = 0;
    for (int j = l; j <= L; j++) flag |= (tmp[j] != 0);
    if (!flag) break;
    while (tmp[l] == 0 && l <= L) l++;
  }
}
void Base_push(int id) {
  read();
  int m = 2005, pos = -1, top = 0;
  rzz.reset();
  rzz[id] = 1;
  for (int i = m; i >= 0; i--)
    if (now[i]) {
      if (!exist[i] && pos == -1) pos = i;
      if (exist[i]) {
        rzz ^= use[i];
        now ^= base[i];
      }
    }
  if (!now.any()) {
    for (int i = 0; i <= id - 1; i++)
      if (rzz[i]) top++;
    printf("%d ", top);
    for (int i = 0; i <= id - 1; i++)
      if (rzz[i]) printf("%d ", i);
    printf("\n");
    return;
  }
  printf("0\n");
  base[pos] = now;
  use[pos] = rzz;
  exist[pos] = 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) Base_push(i - 1);
}
