#include <bits/stdc++.h>
using namespace std;
const int N = 2001;
const int M = 50;
const int inf = 1e9 + 7;
const long long base = 1e18;
const double pi = acos(-1);
const double ep = 1e-9;
long long groupInt[N][M + 2], bitState[N][M + 2];
long long thisState[M + 2], a[N];
int has[N];
long long ans[M + 2];
int n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n + 1; i++) {
    string s;
    cin >> s;
    int k = s.size();
    for (int j = 0; j < k; j++) a[k - j] = s[j] - '0';
    int sl = 0;
    memset(thisState, 0, sizeof(thisState));
    while (k > 0) {
      for (int j = k; j >= 1; j--) {
        a[j - 1] += a[j] % (1ll << M) * 10;
        a[j] /= (1LL << M);
      }
      thisState[++sl] = a[0] / 10;
      a[0] = 0;
      while (k && !a[k]) k--;
    }
    memset(ans, 0, sizeof(ans));
    bool hasSubset = true;
    for (int j = N - 1; j >= 0; j--) {
      if (thisState[j / 50 + 1] & (1ll << (j % 50))) {
        if (!has[j]) {
          hasSubset = false;
          has[j] = 1;
          ans[(i - 1) / 50] ^= (1LL << ((i - 1) % 50));
          for (int l = 0; l <= (i - 1) / 50; l++) groupInt[j][l] = ans[l];
          for (int l = 0; l <= j / 50 + 1; l++) bitState[j][l] = thisState[l];
          break;
        }
        for (int l = 0; l <= (i - 1) / 50; l++) ans[l] ^= groupInt[j][l];
        for (int l = 0; l <= j / 50 + 1; l++) thisState[l] ^= bitState[j][l];
      }
    }
    if (hasSubset) {
      vector<int> res;
      res.clear();
      for (int j = 0; j <= 41; j++) {
        for (int t = 0; t < 50; t++) {
          if (ans[j] & (1LL << t)) {
            res.push_back(j * 50 + t);
          }
        }
      }
      printf("%d ", res.size());
      for (int j = 0; j < res.size(); j++) printf("%d ", res[j]);
      cout << endl;
    } else
      printf("0\n");
  }
}
