#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, m, red, blue;
vector<int> g[N];
int c[N];
int dfs(int u, int col) {
  if (c[u]) return col == c[u];
  for (auto v : g[u]) {
    c[u] = col;
    if (dfs(v, col == 1 ? 2 : 1) == 0) return 0;
  }
  return 1;
}
int main() {
  cin >> n >> m;
  while (m--) {
    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 (!c[i] && dfs(i, 1) == 0) {
      cout << -1 << "\n";
      return 0;
    }
  for (int i = 1; i <= n; i++) {
    if (c[i] == 1) red++;
    if (c[i] == 2) blue++;
  }
  cout << red << "\n";
  for (int i = 1; i <= n; i++)
    if (c[i] == 1) printf("%d ", i);
  cout << "\n" << blue << "\n";
  for (int i = 1; i <= n; i++)
    if (c[i] == 2) printf("%d ", i);
  puts("");
  return 0;
}
