#include <bits/stdc++.h>
using namespace std;
int v[4000][4000];
int desp[4000];
int t[4000][4000];
int nvalor;
long long int valor[4000];
int main() {
  ios::sync_with_stdio(false);
  int m;
  cin >> m;
  int n = 0;
  for (int j = 0; j < m; j++) {
    string s;
    cin >> s;
    nvalor = 1;
    valor[0] = 0;
    for (int i = 0; i < int(s.size()); i++) {
      long long int c = valor[0] * 10 + s[i] - '0';
      valor[0] = 0;
      for (int k = 0; k < nvalor; k++) {
        c += valor[k] * 10;
        valor[k] = c & ((1LL << 32) - 1);
        c >>= 32;
      }
      if (c) valor[nvalor++] = c;
    }
    for (int k = 0; k < nvalor; k++)
      for (int i = 0; i < 32; i++)
        if (valor[k] & (1 << i)) v[32 * k + i][j >> 5] ^= 1 << (j & 31);
    n = max(n, nvalor * 32);
  }
  int i = 0;
  for (int j = 0; j < m; j++) {
    int ic = i;
    for (; ic < n and (v[ic][j >> 5] & (1 << (j & 31))) == 0; ic++)
      ;
    if (ic < n) {
      cout << 0 << endl;
      for (int jj = j >> 5; jj <= ((m - 1) >> 5); jj++)
        swap(v[i][jj], v[ic][jj]);
      for (int ii = i + 1; ii < n; ii++)
        if (v[ii][j >> 5] & (1 << (j & 31)))
          for (int jj = j >> 5; jj <= ((m - 1) >> 5); jj++)
            v[ii][jj] ^= v[i][jj];
      for (int ii = 0; ii <= i; ii++)
        if (v[ii][j >> 5] & (1 << (j & 31))) t[j][ii >> 5] ^= (1 << (ii & 31));
      desp[i] = j;
      i++;
    } else {
      vector<int> sol;
      for (int ii = 0; ii < i; ii++)
        if (v[ii][j >> 5] & (1 << (j & 31))) t[j][ii >> 5] ^= (1 << (ii & 31));
      for (int ii = i - 1; ii >= 0; ii--) {
        if (t[j][ii >> 5] & (1 << (ii & 31))) {
          sol.push_back(desp[ii]);
          for (int iii = (ii >> 5); iii >= 0; iii--)
            t[j][iii] ^= t[desp[ii]][iii];
        }
      }
      cout << int(sol.size());
      for (int i = 0; i < int(sol.size()); i++) cout << " " << sol[i];
      cout << endl;
    }
  }
}
