#include <bits/stdc++.h>
using namespace std;
void _print() { cout << '\n'; }
template <typename T, typename... Ts>
void _print(const T& value, const Ts&... values) {
  cout << ' ' << value;
  _print(values...);
}
template <typename T, typename... Ts>
void print(const T& value, const Ts&... values) {
  cout << value;
  _print(values...);
}
int toInt(char c) { return c - '0'; }
char toChar(int c) { return c + '0'; }
const int lim = 2001;
using binary = bitset<lim + 1>;
const long long base = 1LL << 32;
binary convert(const string& s) {
  vector<long long> v;
  v.push_back(0);
  for (int i = 0; i < s.size(); i += 9) {
    int p10 = 1;
    int val = 0;
    for (int j = 0; j < 9; j++) {
      if (i + j >= s.size()) break;
      val = val * 10 + s[i + j] - '0';
      p10 *= 10;
    }
    for (auto& x : v) x *= p10;
    v[0] += val;
    for (int j = 0; j < v.size(); j++) {
      if (v[j] >= base) {
        if (j + 1 == v.size()) v.push_back(0);
        v[j + 1] += v[j] / base;
        v[j] %= base;
      }
    }
  }
  binary ret;
  for (int i = 0; i < v.size(); i++) {
    for (int j = 0; j < 32; j++) {
      if (i * 32 + j >= ret.size()) break;
      ret[i * 32 + j] = v[i] % 2;
      v[i] /= 2;
    }
  }
  return ret;
}
int n;
binary table[lim];
binary need[lim];
pair<binary, bool> findNum(binary form, bool spec = false) {
  binary now, ret;
  for (int i = (lim); i >= (0); i--) {
    if (now[i] != form[i]) {
      if (need[i].count() == 0) return {ret, false};
      ret ^= need[i];
      now ^= table[i];
    }
  }
  return {ret, true};
}
void addTable(binary form, int p) {
  binary madeOf;
  madeOf[p] = 1;
  for (int i = (lim); i >= (0); i--) {
    if (form[i] == 1) {
      if (need[i].count()) {
        form ^= table[i];
        madeOf ^= need[i];
      } else {
        table[i] = form;
        need[i] = madeOf;
        break;
      }
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = (0); i <= (n - 1); i++) {
    string s;
    cin >> s;
    auto form = convert(s);
    auto [rec, can] = findNum(form);
    if (!can)
      cout << 0 << '\n';
    else {
      cout << rec.count() << ' ';
      for (int j = (0); j <= (lim - 1); j++)
        if (rec[j]) cout << j << ' ';
      cout << '\n';
    }
    addTable(form, i);
  }
}
