#include <bits/stdc++.h>
using namespace std;
int n, tmp[2010], pos[2010];
bitset<2010> newBit, t, m[2010], s[2010];
void change(string st) {
  int len = st.length();
  for (int i = 0; i < len; i++) tmp[i] = st[len - i - 1] - 48;
  newBit = 0;
  bool flag = true;
  int j = 0;
  while (flag) {
    flag = false;
    int k = 0;
    for (int i = len - 1; i >= 0; i--) {
      tmp[i] = tmp[i] + 10 * k;
      k = tmp[i] & ((1 << 20) - 1);
      tmp[i] >>= 20;
      flag |= (tmp[i] > 0);
      if (!flag && i < len) len--;
    }
    t = k;
    newBit |= t << j;
    j += 20;
  }
}
int main() {
  string st;
  cin >> n;
  for (int i = 0; i < 2010; i++) pos[i] = -1;
  for (int i = 0; i < n; i++) {
    cin >> st;
    change(st);
    m[i] = newBit;
    s[i][i] = 1;
    int cnt = 1;
    for (int j = 2010 - 1; j >= 0; j--)
      if (m[i][j]) {
        if (pos[j] == -1) {
          cnt = 0;
          pos[j] = i;
          break;
        } else {
          m[i] ^= m[pos[j]];
          s[i] ^= s[pos[j]];
        }
      }
    if (cnt) {
      s[i][i] = 0;
      cout << s[i].count() << ' ';
      for (int j = 0; j < 2010; j++)
        if (s[i][j]) cout << j << ' ';
      cout << endl;
    } else
      cout << 0 << endl;
  }
}
