#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void ckmax(T& x, T y) {
  x = (y > x ? y : x);
}
template <typename T>
inline void ckmin(T& x, T y) {
  x = (y < x ? y : x);
}
namespace Fread {
const int SIZE = 1 << 21;
char buf[SIZE], *S, *T;
inline char getchar() {
  if (S == T) {
    T = (S = buf) + fread(buf, 1, SIZE, stdin);
    if (S == T) return '\n';
  }
  return *S++;
}
}  // namespace Fread
namespace Fwrite {
const int SIZE = 1 << 21;
char buf[SIZE], *S = buf, *T = buf + SIZE;
inline void flush() {
  fwrite(buf, 1, S - buf, stdout);
  S = buf;
}
inline void putchar(char c) {
  *S++ = c;
  if (S == T) flush();
}
struct NTR {
  ~NTR() { flush(); }
} ztr;
}  // namespace Fwrite
namespace Fastio {
struct Reader {
  template <typename T>
  Reader& operator>>(T& x) {
    char c = Fread ::getchar();
    T f = 1;
    while (c < '0' || c > '9') {
      if (c == '-') f = -1;
      c = Fread ::getchar();
    }
    x = 0;
    while (c >= '0' && c <= '9') {
      x = x * 10 + (c - '0');
      c = Fread ::getchar();
    }
    x *= f;
    return *this;
  }
  Reader& operator>>(char& c) {
    c = Fread ::getchar();
    while (c == '\n' || c == ' ') c = Fread ::getchar();
    return *this;
  }
  Reader& operator>>(char* str) {
    int len = 0;
    char c = Fread ::getchar();
    while (c == '\n' || c == ' ') c = Fread ::getchar();
    while (c != '\n' && c != ' ') {
      str[len++] = c;
      c = Fread ::getchar();
    }
    str[len] = '\0';
    return *this;
  }
  Reader() {}
} cin;
const char endl = '\n';
struct Writer {
  template <typename T>
  Writer& operator<<(T x) {
    if (x == 0) {
      Fwrite ::putchar('0');
      return *this;
    }
    if (x < 0) {
      Fwrite ::putchar('-');
      x = -x;
    }
    static int sta[45];
    int top = 0;
    while (x) {
      sta[++top] = x % 10;
      x /= 10;
    }
    while (top) {
      Fwrite ::putchar(sta[top] + '0');
      --top;
    }
    return *this;
  }
  Writer& operator<<(char c) {
    Fwrite ::putchar(c);
    return *this;
  }
  Writer& operator<<(char* str) {
    int cur = 0;
    while (str[cur]) Fwrite ::putchar(str[cur++]);
    return *this;
  }
  Writer& operator<<(const char* str) {
    int cur = 0;
    while (str[cur]) Fwrite ::putchar(str[cur++]);
    return *this;
  }
  Writer() {}
} cout;
}  // namespace Fastio
const int MAXN = 2000;
const int MAXBITS = 2000;
int n;
struct BinaryBigNumber {
  bitset<MAXBITS> b;
  bool operator!() const { return b.count() == 0; }
  BinaryBigNumber operator^(const BinaryBigNumber& rhs) const {
    BinaryBigNumber res;
    res.b = b ^ rhs.b;
    return res;
  }
  BinaryBigNumber& operator^=(const BinaryBigNumber& rhs) {
    *this = ((*this) ^ rhs);
    return *this;
  }
  BinaryBigNumber() {}
};
Fastio ::Reader& operator>>(Fastio ::Reader& is, BinaryBigNumber& item) {
  static char s[MAXBITS + 5];
  static int t[MAXBITS + 5];
  is >> (s + 1);
  int len = strlen(s + 1);
  reverse(s + 1, s + len + 1);
  for (int i = 1; i <= len; ++i) {
    t[i] = s[i] - '0';
  }
  item.b.reset();
  int cnt = 0;
  while (len) {
    unsigned long long x = 0;
    for (int i = len; i >= 1; --i) {
      x = x * 10 + t[i];
      t[i] = x / 16;
      x %= 16;
    }
    for (int i = 0; i < 4; ++i) {
      item.b[cnt++] = ((x >> i) & 1);
    }
    while (len && !t[len]) {
      --len;
    }
  }
  return is;
}
struct LinerBase {
  BinaryBigNumber base[MAXBITS];
  bitset<MAXN> mask[MAXBITS];
  bitset<MAXN> insert(BinaryBigNumber x, int idx) {
    bitset<MAXN> res;
    res.reset();
    for (int i = MAXBITS - 1; i >= 0; --i) {
      if (x.b[i]) {
        if (!base[i]) {
          base[i] = x;
          res[idx] = 1;
          mask[i] = res;
          res.reset();
          return res;
        }
        x ^= base[i];
        res ^= mask[i];
      }
    }
    return res;
  }
  LinerBase() {}
};
LinerBase LB;
int main() {
  Fastio ::cin >> n;
  for (int i = 0; i < n; ++i) {
    BinaryBigNumber x;
    Fastio ::cin >> x;
    bitset<MAXN> b = LB.insert(x, i);
    if (!b.count()) {
      Fastio ::cout << 0 << Fastio ::endl;
    } else {
      int cnt = b.count();
      Fastio ::cout << cnt << " ";
      int cur = 0;
      for (int j = 0; j < i; ++j) {
        if (b[j]) Fastio ::cout << j << " \n"[++cur == cnt];
      }
    }
  }
  return 0;
}
