#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
vector<int> G[N];
int color[N];
bool dfs(int v) {
  bool ret = true;
  for (auto x : G[v]) {
    if (color[x] && color[x] == color[v]) return false;
    if (color[x] == 0) {
      color[x] = (color[v] == 1) ? 2 : 1;
      ret = ret & dfs(x);
    }
  }
  return ret;
}
int main() {
  int n, m;
  cin >> n >> m;
  int u, v;
  int st;
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
    st = v;
  }
  color[st] = 1;
  bool chk = dfs(st);
  for (int i = 1; i <= n; i++) {
    chk &= dfs(i);
  }
  if (not chk)
    cout << -1 << endl;
  else {
    vector<int> a[3];
    for (int i = 1; i <= n; i++) {
      if (color[i]) a[color[i]].push_back(i);
    }
    cout << a[1].size() << endl;
    for (auto x : a[1]) cout << x << " ";
    cout << endl;
    cout << a[2].size() << endl;
    for (auto x : a[2]) cout << x << " ";
    cout << endl;
  }
  return 0;
}
