#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int n;
int le[2005];
char a[2005][700];
long long b[2005][2005];
long long ta[2005][100];
long long dat[2005];
long long path[2005][2005];
int main() {
  int i, j, k;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%s", a[i]);
  for (i = 0; i < n; i++) {
    int len = strlen(a[i]);
    le[i] = len;
    for (j = 0; j < len; j++) a[i][j] -= '0';
  }
  for (i = 0; i < n; i++) {
    int len = le[i];
    reverse(a[i], a[i] + len);
    for (j = 0; j < len; j += 8) {
      ta[i][j / 8] += (a[i][j]);
      ta[i][j / 8] += (a[i][j + 1]) * 10;
      ta[i][j / 8] += (a[i][j + 2]) * 100;
      ta[i][j / 8] += (a[i][j + 3]) * 1000;
      ta[i][j / 8] += (a[i][j + 4]) * 10000;
      ta[i][j / 8] += (a[i][j + 5]) * 100000;
      ta[i][j / 8] += (a[i][j + 6]) * 1000000;
      ta[i][j / 8] += (a[i][j + 7]) * 10000000;
    }
    for (j = 0; j < 2000; j++) {
      b[i][j / 32] += (ta[i][0] % 2) * (1ll << (j % 32));
      for (k = 0; k < 80; k++)
        ta[i][k] /= 2, ta[i][k] += (ta[i][k + 1] % 2) * 50000000;
    }
  }
  memset(dat, -1, sizeof(dat));
  for (i = 0; i < n; i++) {
    path[i][i / 32] = (1ll << (i % 32));
    for (j = 0; j < 2000; j++) {
      if (b[i][j / 32] & (1ll << (j % 32)) && dat[j] != -1) {
        for (k = 0; k < 70; k++) {
          b[i][k] ^= b[dat[j]][k];
          path[i][k] ^= path[dat[j]][k];
        }
      } else if (b[i][j / 32] & (1ll << (j % 32))) {
      }
    }
    int flag = 0;
    for (j = 0; j < 70; j++) {
      if (b[i][j] != 0) {
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      int sum = 0;
      for (j = 0; j < i; j++) sum += !!(path[i][j / 32] & (1ll << (j % 32)));
      printf("%d ", sum);
      for (j = 0; j < i; j++)
        if (path[i][j / 32] & (1ll << (j % 32))) printf("%d ", j);
      printf("\n");
    } else {
      printf("0\n");
      for (j = 0; j < 2000; j++) {
        if (b[i][j / 32] & (1ll << (j % 32))) {
          dat[j] = i;
          break;
        }
      }
    }
  }
  return 0;
}
