#include <bits/stdc++.h>
using namespace std;
inline void EnableFileIO(const string& fileName) {
  if (fileName.empty()) return;
  freopen((fileName + ".in").c_str(), "r", stdin);
  freopen((fileName + ".out").c_str(), "w", stdout);
  return;
}
const int INF = (1 << 30) - 1;
const long long LINF = (1LL << 61) - 1;
const double EPS = 1e-10;
const int N = 2e3 + 10;
int m;
char buff[N];
int num2[N], num[N];
void div2(int& l) {
  int b = 0;
  for (int i = l - 1; i >= 0; i--) {
    num[i] = b * 10000 + num[i];
    b = num[i] & 1;
    num[i] >>= 1;
  }
  if (num[l - 1] == 0) l--;
}
bitset<N> cur;
bitset<N> ans[N], val[N], a;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  EnableFileIO("");
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%s", buff);
    int l = (int)strlen(buff);
    memset(num2, 0, sizeof num2);
    cur.reset();
    a.reset();
    a.set(i);
    for (int i = 0; i < l; i++) num2[l - i - 1] = buff[i] - '0';
    for (int i = 0; i * 4 < l; i++)
      num[i] = num2[i * 4 + 3] * 1000 + num2[i * 4 + 2] * 100 +
               num2[i * 4 + 1] * 10 + num2[i * 4];
    int len = 0;
    while (l) {
      cur[len++] = num[0] & 1;
      div2(l);
    }
    bool f = 1;
    for (int j = 0; j < N; j++) {
      if (cur[j]) {
        if (!ans[j].count()) {
          f = 0;
          ans[j] = a;
          val[j] = cur;
          break;
        }
        a ^= ans[j];
        cur ^= val[j];
      }
    }
    if (!f) {
      puts("0");
      continue;
    }
    printf("%d ", (int)a.count() - 1);
    for (int j = 0; j < i; j++) {
      if (a[j]) printf("%d ", j);
    }
    printf("\n");
  }
  return 0;
}
