#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> g;
void dfs(int e, int p, vector<int> &col, int cur) {
  col[e] = cur;
  for (int next : g[e]) {
    if (col[next] == cur) {
      cout << -1 << endl;
      exit(0);
    }
    if (col[next] == 0) {
      dfs(next, e, col, 3 - cur);
    }
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  g.resize(n);
  while (m--) {
    int u, v;
    cin >> u >> v;
    --u;
    --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  vector<int> col(n, 0);
  for (int i = 0; i < n; ++i)
    if (col[i] == 0) dfs(i, -1, col, 1);
  if (m == 0) col[1] = 2;
  int k1 = 0, k2 = 0;
  for (int i = 0; i < n; ++i) {
    k1 += col[i] == 1;
    k2 += col[i] == 2;
  }
  cout << k1 << endl;
  for (int i = 0; i < n; ++i)
    if (col[i] == 1) cout << i + 1 << ' ';
  cout << endl;
  cout << k2 << endl;
  for (int i = 0; i < n; ++i)
    if (col[i] == 2) cout << i + 1 << ' ';
  cout << endl;
}
