#include <bits/stdc++.h>
using namespace std;
const int MAX_BIT = 1 << 11;
inline void Divide2(string &s) {
  int r = 0;
  for (int i = (int)s.size() - 1; i >= 0; --i) {
    r = (r << 3) + (r << 1) + s[i];
    s[i] = r >> 1;
    r = r & 1;
  }
  while (!s.empty() && s.back() == 0) s.pop_back();
}
inline void ToBin(string &dec, bitset<MAX_BIT> &bin) {
  for (int i = MAX_BIT - 1; !dec.empty(); --i) {
    bin[i] = dec.front() & 1;
    Divide2(dec);
  }
}
const int NMAX = 2000;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int q;
  cin >> q;
  string dec;
  getline(cin, dec);
  vector<int> idx, msb(q);
  vector<bitset<MAX_BIT>> row_echelon(q), xored(q);
  for (int it = 0; it < q; ++it) {
    getline(cin, dec);
    reverse(dec.begin(), dec.end());
    for (char &c : dec) c -= '0';
    ToBin(dec, row_echelon[it]);
    for (int j = 0; j < (int)idx.size(); ++j) {
      int i = idx[j];
      int bit = msb[i];
      if (row_echelon[it][bit]) {
        row_echelon[it] ^= row_echelon[i];
        xored[it] ^= xored[i];
        xored[it][i] = xored[it][i] ^ 1;
      }
    }
    if (row_echelon[it].count() == 0) {
      cout << xored[it].count() << ' ';
      for (int j = 0; j < (int)idx.size(); ++j) {
        int i = idx[j];
        if (xored[it][i]) {
          cout << i << ' ';
        }
      }
      msb[it] = -1;
    } else {
      cout << 0;
      msb[it] = 0;
      while (row_echelon[it][msb[it]] == 0) ++msb[it];
      idx.emplace_back(it);
    }
    cout << '\n';
  }
}
