#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
long long n, m;
long long vis[N], color[N];
vector<long long> g[N], ans[2];
void dfs(long long k, long long col) {
  if (vis[k]) {
    if (color[k] != col) {
      cout << "-1";
      exit(0);
    }
    return;
  }
  vis[k] = 1;
  color[k] = col;
  ans[col].push_back(k);
  for (auto it : g[k]) dfs(it, col ^ 1);
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m;
  for (long long i = 1; i <= m; i++) {
    long long u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (long long i = 1; i <= n; i++) {
    if (!vis[i]) dfs(i, 0);
  }
  for (long long i = 0; i <= 1; i++) {
    cout << ans[i].size() << "\n";
    for (auto it : ans[i]) cout << it << " ";
    cout << "\n";
  }
  return 0;
}
