#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int to, next;
} edge[1000100];
int n, m, flag, vis[1000100];
int tot, head[1000100], ans;
void init() {
  tot = 0;
  memset(head, -1, sizeof(head));
}
void add_edge(int u, int v) {
  edge[tot].to = v;
  edge[tot].next = head[u];
  head[u] = tot++;
}
void dfs(int u, int val) {
  vis[u] = val;
  if (vis[u]) ans++;
  for (int i = head[u]; i != -1; i = edge[i].next) {
    int v = edge[i].to;
    if (vis[v] != -1) {
      if (vis[v] == vis[u]) flag = 0;
      continue;
    }
    dfs(v, vis[u] ^ 1);
  }
}
int main() {
  int t;
  while (scanf("%d%d", &n, &m) != EOF) {
    init();
    memset(vis, -1, sizeof(vis));
    for (int i = 0; i < m; i++) {
      int u, v;
      scanf("%d%d", &u, &v);
      add_edge(u, v);
      add_edge(v, u);
    }
    flag = 1;
    ans = 0;
    for (int i = 1; i <= n; i++)
      if (vis[i] == -1) dfs(i, 1);
    if (!flag)
      printf("-1\n");
    else {
      printf("%d\n", ans);
      for (int i = 1; i <= n; i++)
        if (vis[i] == 1) printf("%d ", i);
      printf("\n");
      printf("%d\n", n - ans);
      for (int i = 1; i <= n; i++)
        if (!vis[i]) printf("%d ", i);
      printf("\n");
    }
  }
  return 0;
}
