#include <bits/stdc++.h>
using namespace std;
char s[1005];
bitset<2005> num[2005], Xor[2005], ans, val;
int p[2005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%s", s);
    int len = strlen(s);
    reverse(s, s + len);
    for (int j = 0; j < len; ++j) s[j] -= '0';
    int pos = 0;
    while (len) {
      num[i][pos++] = s[0] & 1;
      int c = 0;
      for (int j = len - 1; j >= 0; --j) {
        c *= 10;
        c += s[j];
        s[j] = c >> 1;
        c &= 1;
      }
      while (len && !s[len - 1]) --len;
    }
  }
  memset(p, -1, sizeof(p));
  for (int i = 0; i < n; ++i) {
    ans.reset();
    val.reset();
    bool ok = 1;
    for (int j = 0; j <= 2000; ++j)
      if (num[i][j] ^ val[j]) {
        if (p[j] == -1) {
          ok = 0;
          break;
        }
        val ^= num[p[j]];
        ans ^= Xor[p[j]];
      }
    if (ok) {
      val ^= num[i];
      if (val.count()) ok = 0;
    }
    if (!ok)
      puts("0");
    else {
      int sz = ans.count();
      printf("%d ", sz);
      for (int i = 0; i < n; ++i)
        if (ans[i]) printf("%d ", i);
      puts("");
    }
    Xor[i][i] = 1;
    for (int j = 0; j <= 2000; ++j)
      if (p[j] != -1 && num[i][j]) {
        num[i] ^= num[p[j]];
        Xor[i] ^= Xor[p[j]];
      }
    for (int j = 0; j <= 2000; ++j)
      if (num[i][j]) {
        if (p[j] == -1) p[j] = i;
        break;
      }
  }
  return 0;
}
