#include <bits/stdc++.h>
using namespace std;
int m;
long long u[706];
char s[706];
bitset<4050> b, g[2010];
bool hg[2010];
int main() {
  scanf("%d", &m);
  for (int i = 1; i <= m; ++i) {
    scanf("%s", s);
    memset(u, 0, sizeof u);
    int l = strlen(s);
    for (int i = l - 1; ~i; --i) u[i / 18] = u[i / 18] * 10 + s[l - 1 - i] - 48;
    vector<int> vv;
    int r = 700 - 1;
    while (1) {
      while (r >= 0 && !u[r]) --r;
      if (r < 0) break;
      vv.push_back(u[0] & 1);
      u[0] &= ~1;
      for (int i = r; i >= 0; --i)
        u[i - 1] += 1000000000000000000LL * (u[i] & 1), u[i] >>= 1;
    }
    bitset<4050> o;
    o.reset();
    for (int i = 0; i < vv.size(); ++i) o[i] = vv[i];
    o[i + 2010] = 1;
    bool put = 0;
    for (int i = 0; i < 2010; ++i)
      if (o[i]) {
        if (hg[i]) {
          o ^= g[i];
          continue;
        }
        for (int j = i - 1; j >= 0; --j)
          if (hg[j] && o[j]) o ^= g[j];
        hg[i] = 1;
        g[i] = o;
        for (int j = i + 1; j < 2010; ++j)
          if (hg[j] && g[j][i]) g[j] ^= o;
        put = 1;
        break;
      }
    if (!put) {
      vector<int> v;
      for (int j = 1; j < i; ++j)
        if (o[j + 2010]) v.push_back(j);
      printf("%d", int(v.size()));
      for (auto x : v) printf(" %d", x - 1);
      puts("");
    } else {
      puts("0");
    }
  }
}
