#include <bits/stdc++.h>
using namespace std;
long long int n, m;
vector<long long int> ar[100001];
vector<long long int> res[2];
long long int vis[100001];
long long int col[100001];
bool dfs(long long int node, long long int c) {
  vis[node] = 1;
  res[c].push_back(node);
  col[node] = c;
  for (long long int child : ar[node]) {
    if (vis[child] == 0) {
      if (dfs(child, c ^ 1) == false) return false;
    } else if (col[node] == col[child])
      return false;
  }
  return true;
}
void solve() {
  long long int test = 1;
  while (test--) {
    cin >> n >> m;
    while (m--) {
      long long int a, b;
      cin >> a >> b;
      ar[a].push_back(b);
      ar[b].push_back(a);
    }
    long long int count = 1;
    vector<long long int> von;
    memset(vis, 0, sizeof(vis));
    for (long long int i = 1; i <= n; i++) {
      if (vis[i] == 0) {
        if (ar[i].empty()) continue;
        if (dfs(i, 0) == false) {
          cout << -1 << endl;
          return;
        }
      }
    }
    for (long long int i = 0; i < 2; i++) {
      cout << res[i].size() << endl;
      for (auto x : res[i]) cout << x << " ";
      cout << endl;
    }
  }
  return;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
