#include <bits/stdc++.h>
using namespace std;
const int maxn = 2010;
bitset<maxn> d[maxn], use[maxn], cur, tmp;
bool vis[maxn];
char s[maxn];
int num[maxn];
int main() {
  int m;
  scanf("%d", &m);
  int pos = 0;
  while (m--) {
    scanf("%s", s);
    int len = strlen(s);
    for (int i = 0; i < len; ++i) num[len - 1 - i] = s[i] - '0';
    cur.reset();
    int tot = 0;
    while (len) {
      int lst = 0;
      for (int i = len - 1; i >= 0; --i) {
        num[i] += lst * 10;
        lst = num[i] & 1;
        num[i] >>= 1;
      }
      cur[tot] = lst;
      ++tot;
      while (len && !num[len - 1]) --len;
    }
    tmp.reset();
    tmp[pos] = 0;
    bool tag = 0;
    for (int i = 0; i < maxn; ++i)
      if (cur[i]) {
        if (!vis[i]) {
          vis[i] = 1;
          d[i] = cur;
          use[i] = tmp;
          use[i].flip(pos);
          tag = 1;
          break;
        } else {
          cur ^= d[i];
          tmp ^= use[i];
        }
      }
    if (tag)
      puts("0");
    else {
      int cnt = 0;
      for (int i = 0; i < maxn; ++i)
        if (tmp[i]) ++cnt;
      printf("%d ", cnt);
      for (int i = 0; i < maxn; ++i)
        if (tmp[i]) printf("%d ", i);
      puts("");
    }
    ++pos;
  }
  return 0;
}
