#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.1415926535897932384626433832795l;
template <typename T>
inline auto sqr(T x) -> decltype(x * x) {
  return x * x;
}
template <typename T1, typename T2>
inline bool umx(T1& a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool umn(T1& a, T2 b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const int N = 2000;
struct Input {
  int n;
  string s[N];
  bool read() {
    if (!(cin >> n)) {
      return 0;
    }
    getline(cin, s[0]);
    for (int i = int(0); i < int(n); ++i) {
      getline(cin, s[i]);
    }
    return 1;
  }
  void init(const Input& input) { *this = input; }
};
struct Data : Input {
  vector<int> ans[N];
  void write() {
    for (int i = int(0); i < int(n); ++i) {
      printf("%d", ((int)(ans[i]).size()));
      for (int j = int(0); j < int(((int)(ans[i]).size())); ++j) {
        printf(" %d", ans[i][j]);
      }
      puts("");
    }
  }
  virtual void solve() {}
  virtual void clear() { *this = Data(); }
};
struct Solution : Data {
  static const int L = (N + 63) >> 6;
  unsigned long long m[N][L];
  unsigned long long u[N][L];
  bool need[N];
  int pos[N];
  void solve() {
    memset(m, 0, sizeof m);
    for (int i = int(0); i < int(n); ++i) {
      vector<unsigned long long> q((((int)(s[i]).size()) + 8) / 9, 0);
      for (int j = int(((int)(s[i]).size())) - 1; j >= int(0); --j) {
        (q[((int)(q).size()) - 1 - j / 9] *= 10) +=
            s[i][((int)(s[i]).size()) - 1 - j] - '0';
      }
      for (int k = int(0); k < int(L * 2); ++k) {
        unsigned long long r = 0;
        for (int j = int(0); j < int(((int)(q).size())); ++j) {
          q[j] += r * 1000000000;
          r = q[j] & ((1ull << 32) - 1);
          q[j] >>= 32;
        }
        m[i][k >> 1] |= r << (32 * (k & 1));
      }
    }
    memset(u, 0, sizeof u);
    for (int i = int(0); i < int(n); ++i) {
      u[i][i >> 6] |= 1ull << (i & 63);
      for (int j = int(0); j < int(i); ++j)
        if (need[j]) {
          if (m[i][pos[j] >> 6] & (1ull << (pos[j] & 63))) {
            for (int k = int(0); k < int(L); ++k) {
              m[i][k] ^= m[j][k];
            }
            for (int k = int(0); k < int((i + 63) >> 6); ++k) {
              u[i][k] ^= u[j][k];
            }
          }
        }
      need[i] = 0;
      for (int j = int(0); j < int(N); ++j) {
        if (m[i][j >> 6] & (1ull << (j & 63))) {
          need[i] = 1;
          pos[i] = j;
          break;
        }
      }
      if (!need[i]) {
        for (int j = int(0); j < int(i); ++j) {
          if (u[i][j >> 6] & (1ull << (j & 63))) {
            ans[i].push_back(j);
          }
        }
      }
    }
  }
  void clear() { *this = Solution(); }
};
Solution sol;
int main() {
  cout.setf(ios::showpoint | ios::fixed);
  cout.precision(20);
  sol.read();
  sol.solve();
  sol.write();
  return 0;
}
