#include <bits/stdc++.h>
using namespace std;
long long M, N;
long long viz[100100];
long long ok = 1, x, y;
vector<long long> m[100100], sol[3];
void dfs(long long x, long long c) {
  viz[x] = c;
  sol[c].push_back(x);
  for (auto y : m[x]) {
    if (viz[y]) {
      if (viz[y] == viz[x]) ok = 0;
      continue;
    }
    dfs(y, 3 - c);
  }
}
int main() {
  cin >> N >> M;
  for (int i = 1; i <= M; ++i) {
    cin >> x >> y;
    m[x].push_back(y);
    m[y].push_back(x);
  }
  long long i;
  for (i = 1; i <= N; ++i) {
    if (viz[i] == 0) {
      dfs(i, 1);
    }
  }
  if (ok == 0) {
    cout << -1;
    return 0;
  }
  cout << sol[1].size() << endl;
  for (auto x : sol[1]) {
    cout << x << " ";
  }
  cout << endl;
  cout << sol[2].size() << endl;
  for (auto x : sol[2]) {
    cout << x << " ";
  }
  return 0;
}
