#include <bits/stdc++.h>
using namespace std;
int m;
bool possible[2000];
long long result[2000][32], used[2000][32];
long long b[32], key[32], x[40];
void div2() {
  long long carry = 0;
  for (int i = 0; i < (40); i++) {
    long long v = x[i] + carry;
    if (v & 1)
      carry = 1e15;
    else
      carry = 0;
    x[i] = (v / 2);
  }
}
bool notZero() {
  for (int i = 0; i < (40); i++)
    if (x[i] > 0) return 1;
  return 0;
}
void genBitSet() {
  for (int i = 0; i < (32); i++) b[i] = 0;
  int i = 0;
  while (notZero()) {
    b[i / 64] |= (long long)((x[39] - 0) % 2) << (i % 64);
    div2();
    i++;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> m;
  for (int i = 0; i < (m); i++) {
    string s;
    cin >> s;
    int curr = 39;
    long long mult = 1;
    for (int j = 0; j < (40); j++) x[j] = 0;
    for (int j = (((int)(s).size())) - 1; j >= 0; j--) {
      x[curr] += mult * (s[j] - '0');
      mult *= 10;
      if (mult == 1e15) {
        mult = 1;
        curr--;
      }
    }
    genBitSet();
    for (int j = 0; j < (32); j++) key[j] = 0;
    key[i / 64] |= 1LL << (i % 64);
    bool doable = 1;
    for (int j = 0; j < (2000); j++)
      if (b[j / 64] & (1LL << (j % 64))) {
        if (!possible[j]) {
          doable = 0;
          possible[j] = 1;
          for (int k = 0; k < (32); k++) result[j][k] = b[k];
          for (int k = 0; k < (32); k++) used[j][k] = key[k];
          break;
        } else {
          for (int k = (j / 64); k < (32); k++) b[k] ^= result[j][k];
          for (int k = 0; k < (i / 64 + 1); k++) key[k] ^= used[j][k];
        }
      }
    if (!doable)
      cout << 0 << "\n";
    else {
      vector<int> res;
      for (int j = 0; j < (i); j++)
        if (key[j / 64] & (1LL << (j % 64))) res.push_back(j);
      cout << ((int)(res).size());
      for (const int j : res) cout << " " << j;
      cout << "\n";
    }
  }
}
