#include <bits/stdc++.h>
using namespace std;
const int N = 2000;
inline pair<int, int> getId(int x) { return make_pair(x / 64, x % 64); }
inline int getVal(int pos, unsigned long long *a) {
  pair<int, int> now = getId(pos);
  return ((a[now.first] & (1ull << now.second)) != 0);
}
int tem[N];
int ten[9] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000};
int trans(char *a, unsigned long long *b) {
  int len = (int)strlen(a);
  int cnt = 0;
  memset(tem, 0, sizeof(tem));
  for (int i = 0; i < len; ++i) {
    tem[i >> 3] += (a[i] - '0') * ten[i & 7];
  }
  int now = (len + 16) / 8;
  while (tem[now] == 0) now--;
  while (now >= 0) {
    int preVal = 0;
    for (int i = now; i >= 0; --i) {
      int val = preVal * ten[8] + tem[i];
      tem[i] = (val >> 1);
      preVal = val & 1;
    }
    pair<int, int> pos = getId(cnt);
    if (preVal & 1) b[pos.first] |= (1ull << pos.second);
    cnt++;
    if (tem[now] == 0) --now;
  }
  return cnt;
}
unsigned long long v[N][N / 64 + 1];
unsigned long long S[N][N / 64 + 1];
char s[N];
unsigned long long t[N / 64 + 1];
void print(unsigned long long *a) {
  vector<int> res;
  for (int i = 0; i < N; ++i) {
    if ((a[i / 64] & (1ull << (i % 64))) != 0) {
      res.push_back(i);
    }
  }
  printf("%d", (int)res.size());
  for (int i = 0; i < res.size(); ++i) {
    printf(" %d", res[i]);
  }
  puts("");
}
int main() {
  int n;
  scanf("%d", &n);
  int id = 0;
  while (n--) {
    memset(t, 0, sizeof(t));
    scanf("%s", s);
    reverse(s, s + strlen(s));
    int cnt = trans(s, t);
    unsigned long long res[N / 64 + 1];
    memset(res, 0, sizeof(res));
    for (int i = cnt - 1; i >= 0; --i) {
      if (getVal(i, t) == 1 && getVal(i, v[i]) == 1) {
        for (int j = N / 64; j >= 0; --j) {
          t[j] ^= v[i][j];
          res[j] ^= S[i][j];
        }
      }
    }
    int pos = -1;
    for (int i = cnt - 1; i >= 0; --i) {
      pair<int, int> now = getId(i);
      if ((t[now.first] & (1ull << now.second)) != 0) {
        pos = i;
        break;
      }
    }
    if (pos == -1) {
      print(res);
    } else {
      printf("0\n");
      res[id / 64] |= (1ull << (id % 64));
      for (int i = 0; i <= N / 64; ++i) {
        S[pos][i] = res[i];
      }
      for (int i = N / 64; i >= 0; --i) v[pos][i] = t[i];
      pair<int, int> now = getId(pos);
      for (int i = pos + 1; i < N; ++i) {
        if ((v[i][now.first] & (1ull << now.second)) != 0) {
          for (int j = N / 64; j >= 0; --j) {
            v[i][j] ^= t[j];
            S[i][j] ^= res[j];
          }
        }
      }
    }
    id++;
  }
  return 0;
}
