#include <bits/stdc++.h>
using namespace std;
bool col[100005], vis[100005];
vector<int> g[100005];
bool bad;
void dfs(int u) {
  vis[u] = true;
  for (auto v : g[u]) {
    if (vis[v]) {
      if (col[u] == col[v]) {
        bad = true;
      }
    } else {
      col[v] = 1 - col[u];
      dfs(v);
    }
  }
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 1; i <= n; ++i) {
    if (!vis[i]) {
      col[i] = 0;
      dfs(i);
    }
  }
  vector<int> A, B;
  for (int i = 1; i <= n; ++i) {
    if (col[i]) {
      A.push_back(i);
    } else {
      B.push_back(i);
    }
  }
  if (bad) {
    printf("-1");
  } else {
    printf("%d\n", (int)A.size());
    for (auto x : A) {
      printf("%d ", x);
    }
    printf("\n");
    printf("%d\n", (int)B.size());
    for (auto x : B) {
      printf("%d ", x);
    }
    printf("\n");
  }
}
