#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> graph;
int n, m;
vector<int> reds;
vector<int> blacks;
vector<int> colours;
bool bfs(int s) {
  queue<int> q;
  q.push(s);
  colours[s] = 1;
  reds.push_back(s);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int v : graph[u]) {
      if (colours[v] == 0) {
        q.push(v);
        if (colours[u] == 1) {
          colours[v] = 2;
          blacks.push_back(v);
        } else {
          colours[v] = 1;
          reds.push_back(v);
        }
      } else if (colours[v] == colours[u]) {
        return false;
      }
    }
  }
  return true;
}
bool is_bipartite() {
  colours.resize(n);
  fill(colours.begin(), colours.end(), 0);
  for (int i = 0; i < n; i++) {
    if (colours[i] == 0) {
      if (!bfs(i)) {
        return false;
      }
    }
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  graph.resize(n);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  if (!is_bipartite()) {
    cout << -1 << '\n';
  } else {
    cout << reds.size() << '\n';
    for (int u : reds) {
      cout << u + 1 << ' ';
    }
    cout << '\n';
    cout << blacks.size() << '\n';
    for (int u : blacks) {
      cout << u + 1 << ' ';
    }
    cout << '\n';
  }
  return 0;
}
