#include <bits/stdc++.h>
using namespace std;
vector<int> adj[100010];
int vis[100010];
int dfs(int in, int col) {
  vis[in] = col;
  for (int i = 0; i < (int)adj[in].size(); i++) {
    if (vis[adj[in][i]]) {
      if (vis[adj[in][i]] == col) {
        return 0;
      }
      continue;
    }
    int ret = dfs(adj[in][i], 3 - col);
    if (ret == 0) return 0;
  }
  return 1;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  while (m--) {
    int u, v;
    scanf("%d%d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 0) {
      if (dfs(i, 1) == 0) {
        printf("-1");
        return 0;
      }
    }
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 1) cnt++;
  }
  printf("%d\n", cnt);
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 1) printf("%d ", i);
  }
  printf("\n");
  printf("%d\n", n - cnt);
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 2) printf("%d ", i);
  }
  printf("\n");
  return 0;
}
