#include <bits/stdc++.h>
using namespace std;
int reader_pt = 1048576, reader_last;
char reader_buf[1048576];
int writer_pt = 0;
char writer_buf[1048576];
void reader(int *x) {
  int k, m = 0;
  *x = 0;
  for (;;) {
    {
      if (reader_pt == 1048576)
        reader_pt = 0,
        reader_last = fread(reader_buf, sizeof(char), 1048576, stdin);
      (k) = reader_buf[reader_pt++];
    };
    if (k == '-') {
      m = 1;
      break;
    }
    if ('0' <= k && k <= '9') {
      *x = k - '0';
      break;
    }
  }
  for (;;) {
    {
      if (reader_pt == 1048576)
        reader_pt = 0,
        reader_last = fread(reader_buf, sizeof(char), 1048576, stdin);
      (k) = reader_buf[reader_pt++];
    };
    if (k < '0' || k > '9') break;
    *x = (*x) * 10 + k - '0';
  }
  if (m) (*x) = -(*x);
}
void reader(long long *x) {
  int k, m = 0;
  *x = 0;
  for (;;) {
    {
      if (reader_pt == 1048576)
        reader_pt = 0,
        reader_last = fread(reader_buf, sizeof(char), 1048576, stdin);
      (k) = reader_buf[reader_pt++];
    };
    if (k == '-') {
      m = 1;
      break;
    }
    if ('0' <= k && k <= '9') {
      *x = k - '0';
      break;
    }
  }
  for (;;) {
    {
      if (reader_pt == 1048576)
        reader_pt = 0,
        reader_last = fread(reader_buf, sizeof(char), 1048576, stdin);
      (k) = reader_buf[reader_pt++];
    };
    if (k < '0' || k > '9') break;
    *x = (*x) * 10 + k - '0';
  }
  if (m) (*x) = -(*x);
}
int reader(char c[]) {
  int i, s = 0;
  for (;;) {
    {
      if (reader_pt == 1048576)
        reader_pt = 0,
        reader_last = fread(reader_buf, sizeof(char), 1048576, stdin);
      (i) = reader_buf[reader_pt++];
    };
    if (i != ' ' && i != '\n' && i != '\r' && i != '\t' && i != EOF) break;
  }
  c[s++] = i;
  for (;;) {
    {
      if (reader_pt == 1048576)
        reader_pt = 0,
        reader_last = fread(reader_buf, sizeof(char), 1048576, stdin);
      (i) = reader_buf[reader_pt++];
    };
    if (i == ' ' || i == '\n' || i == '\r' || i == '\t' || i == EOF) break;
    c[s++] = i;
  }
  c[s] = '\0';
  return s;
}
template <class T, class S>
void reader(T *x, S *y) {
  reader(x);
  reader(y);
}
template <class T, class S, class U>
void reader(T *x, S *y, U *z) {
  reader(x);
  reader(y);
  reader(z);
}
template <class T, class S, class U, class V>
void reader(T *x, S *y, U *z, V *w) {
  reader(x);
  reader(y);
  reader(z);
  reader(w);
}
void writer(int x, char c) {
  int s = 0, m = 0;
  char f[10];
  if (x < 0) m = 1, x = -x;
  while (x) f[s++] = x % 10, x /= 10;
  if (!s) f[s++] = 0;
  if (m) {
    if (writer_pt == 1048576)
      writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
    writer_buf[writer_pt++] = ('-');
  };
  while (s--) {
    if (writer_pt == 1048576)
      writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
    writer_buf[writer_pt++] = (f[s] + '0');
  };
  {
    if (writer_pt == 1048576)
      writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
    writer_buf[writer_pt++] = (c);
  };
}
void writer(long long x, char c) {
  int s = 0, m = 0;
  char f[20];
  if (x < 0) m = 1, x = -x;
  while (x) f[s++] = x % 10, x /= 10;
  if (!s) f[s++] = 0;
  if (m) {
    if (writer_pt == 1048576)
      writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
    writer_buf[writer_pt++] = ('-');
  };
  while (s--) {
    if (writer_pt == 1048576)
      writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
    writer_buf[writer_pt++] = (f[s] + '0');
  };
  {
    if (writer_pt == 1048576)
      writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
    writer_buf[writer_pt++] = (c);
  };
}
void writer(const char c[]) {
  int i;
  for (i = 0; c[i] != '\0'; i++) {
    if (writer_pt == 1048576)
      writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
    writer_buf[writer_pt++] = (c[i]);
  };
}
void writer(const char x[], char c) {
  int i;
  for (i = 0; x[i] != '\0'; i++) {
    if (writer_pt == 1048576)
      writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
    writer_buf[writer_pt++] = (x[i]);
  };
  {
    if (writer_pt == 1048576)
      writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
    writer_buf[writer_pt++] = (c);
  };
}
template <class T>
void writerLn(T x) {
  writer(x, '\n');
}
template <class T, class S>
void writerLn(T x, S y) {
  writer(x, ' ');
  writer(y, '\n');
}
template <class T, class S, class U>
void writerLn(T x, S y, U z) {
  writer(x, ' ');
  writer(y, ' ');
  writer(z, '\n');
}
template <class T>
void writerArr(T x[], int n) {
  int i;
  if (!n) {
    {
      if (writer_pt == 1048576)
        writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
      writer_buf[writer_pt++] = ('\n');
    };
    return;
  }
  for (i = 0; i < n - 1; i++) writer(x[i], ' ');
  writer(x[n - 1], '\n');
}
unsigned long long mat[2100][40];
int binaryGaussJordan(int r, int c, int right) {
  int i, j, k, b = (c + right + 63) / 64, rank = 0;
  for (j = 0; j < c; j++) {
    for (i = rank; i < r; i++)
      if (mat[i][j >> 6] & (1ULL << (j & 63))) break;
    if (i == r) continue;
    if (i != rank)
      for (k = j >> 6; k < b; k++) swap(mat[i][k], mat[rank][k]);
    for (i = 0; i < r; i++)
      if (i != rank)
        if (mat[i][j >> 6] & (1ULL << (j & 63)))
          for (k = j >> 6; k < b; k++) mat[i][k] ^= mat[rank][k];
    rank++;
  }
  return rank;
}
int N;
char in[2010][2010];
char buf[2000];
int arr[2000], sz;
int ind[2222];
int ress, res[2222];
int main() {
  int i, j, k, x;
  reader(&N);
  for (x = 0; x < N; x++) {
    sz = reader(buf);
    for (i = 0; i < sz; i++) arr[i] = buf[sz - 1 - i] - '0';
    for (i = 0; i < 2000; i++) in[x][i] = 0;
    for (i = 0; i < 2000; i++) {
      in[x][i] = arr[0] % 2;
      arr[0] /= 2;
      for (j = 1; j < sz; j++) {
        arr[j - 1] += 5 * (arr[j] % 2);
        arr[j] /= 2;
      }
      if (arr[sz - 1] == 0) sz--;
      if (sz == 0) break;
    }
  }
  for (i = 0; i < N; i++)
    for (j = 0; j < 2000; j++) {
      if (in[i][j]) mat[j][i / 64] |= (1ULL << (i % 64));
    }
  binaryGaussJordan(2000, N, 0);
  k = 0;
  for (i = 0; i < N; i++) {
    if (mat[k][i / 64] & (1ULL << (i % 64))) {
      ind[k++] = i;
      writerLn(0);
    } else {
      ress = 1;
      for (j = 0; j < k; j++)
        if (mat[j][i / 64] & (1ULL << (i % 64))) res[ress++] = ind[j];
      res[0] = ress - 1;
      writerArr(res, ress);
    }
  }
  {
    fwrite(writer_buf, sizeof(char), writer_pt, stdout);
    writer_pt = 0;
  };
  return 0;
}
