#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9;
long long n, m;
vector<vector<long long> > G;
vector<long long> color;
bool dfs(long long v, long long c) {
  color[v] = c;
  for (auto u : G[v]) {
    if (color[u] == c) return false;
    if (color[u] == -1 && !dfs(u, c ^ 1)) return false;
  }
  return true;
}
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  scanf("%d%d", &n, &m);
  G.resize(n);
  for (long long i = 0; i < (m); i++) {
    long long a, b;
    scanf("%d%d", &a, &b);
    a--, b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }
  color.resize(n, -1);
  long long c = 0;
  for (long long i = 0; i < (n); i++) {
    if (color[i] != -1) continue;
    if (!dfs(i, c)) {
      printf("-1\n");
      return 0;
    }
    c ^= 1;
  }
  vector<vector<long long> > v(2);
  for (long long i = 0; i < (n); i++) {
    v[color[i]].emplace_back(i);
  }
  if (v[0].empty() || v[1].empty()) {
    printf("-1\n");
    return 0;
  }
  for (long long k = 0; k < (2); k++) {
    printf("%d\n", v[k].size());
    for (long long i = 0; i < (v[k].size()); i++) {
      if (i != 0) printf(" ");
      printf("%d", v[k][i] + 1);
    }
    printf("\n");
  }
}
