#include <bits/stdc++.h>
using namespace std;
const int inf = 1e5 + 1;
vector<int> graph[inf];
vector<int> color(inf, -1);
vector<int> visited(inf, 0);
int flag = 1;
void dfs(int root) {
  visited[root] = 1;
  for (auto child : graph[root]) {
    if (!visited[child]) {
      color[child] = (color[root] ^ 1);
      dfs(child);
    } else {
      if (color[child] != (color[root] ^ 1)) {
        flag = 0;
        return;
      }
    }
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  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);
  }
  for (int i = 0; i < n; i++) {
    if (graph[i].size() == 0) {
      continue;
    }
    if (!visited[i]) {
      color[i] = 0;
      dfs(i);
    }
  }
  if (!flag) {
    cout << -1 << endl;
  } else {
    vector<int> a;
    vector<int> b;
    for (int i = 0; i < n; i++) {
      if (color[i] == 0) {
        a.push_back(i + 1);
      } else if (color[i] == 1) {
        b.push_back(i + 1);
      }
    }
    cout << a.size() << endl;
    for (int i = 0; i < a.size(); i++) {
      cout << a[i] << " ";
    }
    cout << endl;
    cout << b.size() << endl;
    for (int i = 0; i < b.size(); i++) {
      cout << b[i] << " ";
    }
    cout << endl;
  }
  return 0;
}
