#include <bits/stdc++.h>
using namespace std;
string Next() {
  string S;
  cin >> S;
  return S;
}
int NextInt() {
  int n;
  scanf("%d", &n);
  return n;
}
long long NextLong() {
  long long n;
  scanf("%lld", &n);
  return n;
}
const int N = (int)1e5 + 10;
int n, m, c[N];
vector<int> adj[N];
void DFS(int u) {
  for (int i = 0; i < (int)adj[u].size(); ++i) {
    int v = adj[u][i];
    if (c[v] == -1) {
      c[v] = 1 - c[u];
      DFS(v);
    } else if (c[v] == c[u]) {
      puts("-1");
      exit(0);
    }
  }
}
int main() {
  n = NextInt();
  m = NextInt();
  while (m--) {
    int u = NextInt();
    int v = NextInt();
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  memset(c, -1, sizeof c);
  for (int i = 1; i <= n; ++i) {
    if (adj[i].empty()) {
      c[i] = 2;
      continue;
    }
    if (c[i] == -1) {
      c[i] = 0;
      DFS(i);
    }
  }
  vector<int> ans[3];
  for (int i = 1; i <= n; ++i) ans[c[i]].push_back(i);
  for (int k = 0; k < 2; ++k) {
    printf("%d\n", (int)ans[k].size());
    for (int i = 0; i < (int)ans[k].size(); ++i) printf("%d ", ans[k][i]);
    puts("");
  }
  return 0;
}
