#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2000;
using Long = vector<ll>;
istream& operator>>(istream& in, Long& a) {
  string s;
  in >> s;
  reverse(s.begin(), s.end());
  ll d10 = 0;
  a.clear();
  for (int i = 0; i < s.size(); ++i, d10 *= 10) {
    if (i % 9 == 0) {
      a.push_back(0);
      d10 = 1;
    }
    a.back() += d10 * (s[i] - '0');
  }
  return in;
}
Long div2(Long a) {
  int r = 0;
  Long res(a.size());
  for (int i = a.size() - 1; i >= 0; --i) {
    res[i] = (a[i] + r * (ll)1e9) / 2;
    r = (a[i] + r * (ll)1e9) % 2;
  }
  while (!res.empty() && res.back() == 0) res.pop_back();
  return res;
}
bitset<N> convert(Long number) {
  bitset<N> result;
  for (int i = 0; i < N; ++i) {
    if (number.empty()) {
      break;
    }
    if (number[0] % 2) {
      result.set(i);
    }
    number = div2(number);
  }
  return result;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int m;
  cin >> m;
  vector<bitset<N> > a(m, 0);
  for (int i = 0; i < m; ++i) {
    Long s;
    cin >> s;
    a[i] = convert(s);
  }
  vector<int> M(N, -1);
  vector<bitset<N> > combination(m);
  for (int i = 0; i < m; ++i) {
    combination[i][i] = 1;
  }
  for (int i = 0; i < m; ++i) {
    bool ans = 1;
    for (int j = 0; j < N; ++j) {
      if (!a[i][j]) {
        continue;
      }
      if (M[j] == -1) {
        M[j] = i;
        ans = 0;
        break;
      } else {
        a[i] ^= a[M[j]];
        combination[i] ^= combination[M[j]];
      }
    }
    if (!ans) {
      cout << 0 << endl;
      continue;
    }
    vector<int> res;
    for (int j = 0; j < i; ++j) {
      if (combination[i][j]) {
        res.push_back(j);
      }
    }
    cout << res.size() << ' ';
    for (int j = 0; j < res.size(); ++j) {
      cout << res[j] << ' ';
    }
    cout << '\n';
  }
}
