#include <bits/stdc++.h>
using namespace std;
const int maxn = 4040, MAX = 2020, Base = 1e8;
bitset<maxn> bs[maxn], bn;
int C, pos[maxn];
vector<int> ans;
long long arr[maxn], tn[10];
void Add(int ind) {
  for (int i = 0; i < C; i++) {
    if (bn[pos[i]]) bn = bn ^ bs[i];
  }
  bool is = 0;
  for (int i = 0; i < MAX; i++) is |= bn[i];
  if (!is) {
    ans.clear();
    for (int j = MAX; j < maxn; j++) {
      if (bn[j]) ans.push_back(j - MAX);
    }
    return;
  }
  ans.clear();
  int frst = -1;
  for (int j = 0; j < MAX; j++) {
    if (bn[j]) frst = j;
  }
  bn[ind + MAX] = bn[ind + MAX] ^ 1;
  for (int i = 0; i < C; i++) {
    if (bs[i][frst]) bs[i] = bs[i] ^ bn;
  }
  bs[C] = bn;
  pos[C] = frst;
  C++;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  tn[0] = 1;
  for (int i = 1; i < 9; i++) {
    tn[i] = tn[i - 1] * 10;
  }
  int q;
  cin >> q;
  for (int I = 0; I < q; I++) {
    string s;
    cin >> s;
    int n = int((s).size());
    for (int i = n - 1; i >= 0; i--) {
      arr[(n - 1 - i) >> 3] += tn[(n - 1 - i) & 7] * (s[i] - '0');
    }
    bn = 0;
    int lst = 0;
    n = (n + 15) / 8;
    while (n >= 0 && arr[n] == 0) --n;
    while (n >= 0) {
      int x = arr[0] & 7;
      bn[lst++] = (((x) >> (0)) & 1);
      bn[lst++] = (((x) >> (1)) & 1);
      bn[lst++] = (((x) >> (2)) & 1);
      arr[0] -= x;
      for (int i = n; i >= 0; i--) {
        int rem = arr[i] & 7;
        if (rem != 0) arr[i - 1] += Base * rem;
        arr[i] >>= 3;
      }
      while (n >= 0 && arr[n] == 0) --n;
    }
    Add(I);
    cout << int((ans).size()) << " ";
    for (int x : ans) cout << x << " ";
    cout << "\n";
  }
  return 0;
}
