#include <bits/stdc++.h>
using namespace std;
vector<int> graph[100001];
int color[100001];
vector<int> b, w;
void bfs(int v) {
  queue<int> q;
  q.push(v);
  color[v] = 1;
  b.push_back(v);
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (int u : graph[v]) {
      if (color[u] == 0) {
        if (color[v] == 1)
          color[u] = 2, w.push_back(u);
        else
          color[u] = 1, b.push_back(u);
        q.push(u);
      }
      if (color[v] == color[u]) {
        printf("-1");
        exit(0);
      }
    }
  }
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  while (m--) {
    int a, b;
    scanf("%d %d", &a, &b);
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  for (int i = 1; i <= n; i++)
    if (color[i] == 0) bfs(i);
  printf("%d\n", (int)b.size());
  for (int i = 0; i < b.size(); i++) printf("%d ", b[i]);
  printf("\n%d\n", (int)w.size());
  for (int i : w) printf("%d ", i);
  return 0;
}
