#include <bits/stdc++.h>
using namespace std;
bitset<4000> str2(char* S) {
  vector<int> num;
  for (int i = 0; S[i]; i++) num.push_back(S[i] - '0');
  reverse(num.begin(), num.end());
  bitset<4000> ans;
  for (int k = 0; num.size(); k++) {
    ans[k] = num[0] & 1;
    int sz = num.size();
    for (int i = 0; i < sz - 1; i++) {
      num[i] = (num[i] + (num[i + 1] & 1) * 10) >> 1;
    }
    num.back() >>= 1;
    if (num.back() == 0) num.pop_back();
  }
  return ans;
}
vector<bitset<4000> > Mat;
vector<int> pivot(2000, -1);
vector<int> calc(bitset<4000>& v, int my) {
  for (int i = 0; i < 2000; i++)
    if (v[i]) {
      if (pivot[i] >= 0) {
        int p = pivot[i];
        v ^= Mat[p];
      } else {
        v[2000 + my] = 1;
        pivot[i] = Mat.size();
        Mat.push_back(v);
        return {};
      }
    }
  vector<int> ans;
  for (int i = 0; i < 2000; i++)
    if (v[2000 + i]) ans.push_back(i);
  return ans;
}
int main() {
  int M;
  cin >> M;
  for (int i = 0; i < M; i++) {
    char S[610];
    scanf("%s", S);
    auto v = str2(S);
    auto ans = calc(v, i);
    printf("%d", ans.size());
    for (int a : ans) printf(" %d", a);
    printf("\n");
  }
  return 0;
}
