#include <bits/stdc++.h>
using namespace std;
const int INF = 0x6fffffff;
const int MINF = 0x80000000;
const long long mod = 1000000007;
const int cons = 100001;
const double pi = 3.141592653589793;
vector<vector<int> > adj;
int f[100001];
int fn(int u) {
  if (f[u] == u) return f[u];
  return f[u] = fn(f[u]);
}
void unite(int u, int v) { f[fn(u)] = fn(v); }
vector<int> ans[2];
int chk[100001];
bool vis[100001];
void dfs(int u, int par, int h) {
  ans[h % 2].push_back(u);
  chk[u] = h % 2;
  vis[u] = true;
  for (auto v : adj[u]) {
    if (v == par) continue;
    dfs(v, u, h + 1);
  }
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  adj.resize(n + 1);
  vector<pair<int, int> > e;
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    e.push_back(make_pair(u, v));
  }
  for (int i = 1; i <= n; i++) {
    f[i] = i;
  }
  for (int i = 0; i < e.size(); i++) {
    int u = e[i].first;
    int v = e[i].second;
    int fu = fn(u);
    int fv = fn(v);
    if (fu == fv) continue;
    unite(fu, fv);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    if (adj[i].size() == 0) continue;
    dfs(i, -1, 0);
  }
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < e.size(); j++) {
      int u = e[j].first;
      int v = e[j].second;
      if (chk[u] != i && chk[v] != i) {
        puts("-1");
        return 0;
      }
    }
  }
  for (int i = 0; i < 2; i++) {
    printf("%d\n", ans[i].size());
    for (int j = 0; j < ans[i].size(); j++) {
      printf("%d ", ans[i][j]);
    }
    puts("");
  }
  return 0;
}
