#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m, u, v, cand = 1;
  cin >> n >> m;
  vector<bool> vu(n + 1);
  vector<vector<int>> adj(n + 1);
  while (m--) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
    if (!vu[u]) vu[u] = true;
    if (!vu[v]) vu[v] = true;
  }
  vector<int> color(n + 1);
  vector<vector<int>> ans(3);
  while (true) {
    while (cand <= n) {
      if (vu[cand] and color[cand] == 0) break;
      ++cand;
    }
    if (cand > n) break;
    queue<int> q;
    q.push(cand);
    color[cand] = 1;
    ans[1].push_back(cand);
    while (!q.empty()) {
      int node = q.front();
      int c = color[node];
      q.pop();
      for (int i : adj[node]) {
        if (color[i] == c) {
          cout << "-1";
          return 0;
        }
        if (color[i] == 0) {
          color[i] = 3 - c;
          ans[3 - c].push_back(i);
          q.push(i);
        }
      }
    }
  }
  cout << ans[1].size() << '\n';
  for (int i : ans[1]) cout << i << ' ';
  cout << '\n';
  cout << ans[2].size() << '\n';
  for (int i : ans[2]) cout << i << ' ';
  cout << '\n';
  return 0;
}
