#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100100;
vector<int> g[MAXN];
int n, m;
int color[MAXN];
vector<int> ans[3];
bool dfs(int v, int col = 1) {
  color[v] = col;
  for (int i = 0; i < (int)g[v].size(); ++i) {
    int to = g[v][i];
    if (!color[to]) {
      if (dfs(to, 3 - col)) return true;
    } else if (color[v] == color[to])
      return true;
  }
  return false;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0, a, b; i < m; ++i) {
    scanf("%d%d", &a, &b);
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 1; i <= n; ++i) {
    if (!color[i]) {
      if (dfs(i)) {
        puts("-1");
        return 0;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    ans[color[i]].push_back(i);
  }
  printf("%d\n", (int)ans[1].size());
  for (auto it : ans[1]) {
    printf("%d ", it);
  }
  puts("");
  printf("%d\n", (int)ans[2].size());
  for (auto it : ans[2]) {
    printf("%d ", it);
  }
  puts("");
  return 0;
}
