#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 5;
vector<int> G[N];
vector<int> ans[3];
int n, m;
int col[N];
int dfs(int u, int x, int fa) {
  col[u] = x;
  ans[x].push_back(u);
  for (auto v : G[u]) {
    if (col[u] == col[v]) return 1;
    if (v != fa && !col[v] && dfs(v, 3 - x, u)) return 1;
  }
  return 0;
}
int main() {
  while (scanf("%d%d", &n, &m) == 2) {
    memset(col, 0, sizeof(col));
    ans[1].clear(), ans[2].clear();
    for (int i = 0; i <= n; i++) G[i].clear();
    for (int i = 0; i < m; i++) {
      int u, v;
      scanf("%d%d", &u, &v);
      G[u].push_back(v), G[v].push_back(u);
    }
    int flag = 0;
    for (int i = 1; i <= n; i++) {
      if (!G[i].size()) col[i] = 2;
      if (!col[i]) flag = dfs(i, 2, 0);
      if (flag) break;
    }
    if (flag)
      puts("-1");
    else {
      printf("%d\n", ans[1].size());
      for (auto u : ans[1]) printf("%d ", u);
      puts("");
      printf("%d\n", ans[2].size());
      for (auto u : ans[2]) printf("%d ", u);
      puts("");
    }
  }
  return 0;
}
