#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
int n, m;
vector<int> G[100005], ans[2];
int col[100005];
bool dfs(int x, int y) {
  col[x] = y;
  ans[y].push_back(x);
  for (int v : G[x]) {
    if (col[v] == -1) {
      if (!dfs(v, !y)) return false;
    } else {
      if (col[v] == y) return false;
    }
  }
  return true;
}
int main() {
  scanf("%d%d", &n, &m);
  while (m--) {
    int x, y;
    scanf("%d%d", &x, &y);
    G[x].push_back(y);
    G[y].push_back(x);
  }
  memset(col, -1, sizeof(col));
  bool flag = true;
  for (int i = 1; i <= n; i++)
    if (col[i] == -1) {
      if (!dfs(i, 1)) {
        flag = false;
        break;
      }
    }
  if (!flag) {
    puts("-1");
    return 0;
  }
  for (int i = 0; i < 2; i++) {
    printf("%d\n", ans[i].size());
    for (int v : ans[i]) printf("%d ", v);
    putchar('\n');
  }
}
