#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> G[100001];
int color[100001];
int bfs(int pos, int c) {
  int i, j;
  color[pos] = c;
  for (i = 0; i < G[pos].size(); i++) {
    if (color[G[pos][i]] == c) return 0;
    if (color[G[pos][i]] == 0 && !bfs(G[pos][i], -c)) return 0;
  }
  return 1;
}
int solve() {
  int i, j;
  for (i = 1; i <= n; i++) {
    if (color[i] == 0) {
      if (bfs(i, 1) == 0) return 0;
    }
  }
  return 1;
}
int main() {
  int i, j;
  int u, v;
  while (~scanf("%d %d", &n, &m)) {
    memset(color, 0, sizeof(color));
    for (i = 1; i <= n; i++) G[i].clear();
    for (i = 0; i < m; i++) {
      cin >> u >> v;
      G[u].push_back(v);
      G[v].push_back(u);
    }
    if (solve()) {
      int a[100000];
      int b[100000];
      int t = 0;
      int tt = 0;
      for (i = 1; i <= n; i++) {
        if (color[i] == 1) {
          a[t++] = i;
        } else if (color[i] == -1) {
          b[tt++] = i;
        }
      }
      printf("%d\n", t);
      for (i = 0; i < t; i++) printf("%d ", a[i]);
      printf("\n");
      printf("%d\n", tt);
      for (i = 0; i < tt; i++) printf("%d ", b[i]);
      printf("\n");
    } else
      printf("-1\n");
  }
  return 0;
}
