#include <bits/stdc++.h>
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
using namespace ::std;
const long long maxn = 2010;
bitset<maxn> bi[maxn];
bitset<maxn> sefr;
bitset<maxn> num[maxn];
bitset<maxn> az_ki[maxn];
long long kidare[maxn];
void add(long long a) {
  az_ki[a][a] = 1;
  num[a] = bi[a];
  for (long long i = maxn - 1; i >= 0; i--) {
    if (num[a][i] && kidare[i] == -1) {
      kidare[i] = a;
      break;
    }
    if (num[a][i] && kidare[i] != -1) {
      az_ki[a] ^= az_ki[kidare[i]];
      num[a] ^= num[kidare[i]];
    }
  }
}
void pri(long long a) {
  bitset<maxn> ans = sefr;
  bitset<maxn> anski = sefr;
  for (long long i = maxn - 1; i >= 0; i--) {
    if (ans[i] != bi[a][i]) {
      if (kidare[i] == -1) {
        cout << 0 << endl;
        return;
      }
      ans ^= num[kidare[i]];
      anski ^= az_ki[kidare[i]];
    }
  }
  cout << anski.count() << ' ';
  for (long long i = 0; i < maxn; i++) {
    if (anski[i]) {
      cout << i << ' ';
    }
  }
  cout << endl;
}
void do_it(string s, long long a) {
  const long long maxm = 650 / 15;
  for (long long i = 0; i < s.size(); i++) {
    s[i] -= '0';
  }
  reverse(s.begin(), s.end());
  long long b[maxm];
  fill(b, b + maxm, 0);
  long long res = 1;
  for (long long i = 0; i < s.size(); i++) {
    b[i / 15] += (res * s[i]);
    res *= 10;
    if (i % 15 == 14) {
      res = 1;
    }
  }
  for (long long j = 0; j < maxn; j++) {
    bi[a][j] = b[0] % 2;
    b[0] -= bi[a][j];
    vector<long long> d;
    d.reserve(maxm);
    long long posh = 0;
    for (long long i = maxm - 1; i >= 0; i--) {
      d.push_back((posh + b[i]) / 2);
      if ((posh + b[i]) % 2 != 0) {
        posh = 1e15;
      } else {
        posh = 0;
      }
    }
    reverse(d.begin(), d.end());
    for (long long i = 0; i < d.size(); i++) {
      b[i] = d[i];
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long m;
  cin >> m;
  for (long long i = 0; i < m; i++) {
    string s;
    cin >> s;
    do_it(s, i);
  }
  fill(kidare, kidare + maxn, -1);
  for (long long i = 0; i < m; i++) {
    pri(i);
    add(i);
  }
}
