#include <bits/stdc++.h>
using namespace std;
vector<int> graph[100010];
int marked[100010];
vector<int> color[2];
bool dfs_color(int s, int c = 2) {
  marked[s] = c;
  if (graph[s].empty()) return true;
  color[c - 1].push_back(s);
  for (int i = 0; i < (int)graph[s].size(); ++i) {
    if ((!marked[graph[s][i]])) {
      if (!dfs_color(graph[s][i], 3 - c)) {
        return false;
      }
    }
    if (marked[graph[s][i]] == c) {
      return false;
    }
  }
  return true;
}
int main() {
  memset(marked, 0, sizeof(marked));
  int n, m;
  int s, e;
  cin >> n >> m;
  while (m--) {
    cin >> s >> e;
    graph[s - 1].push_back(e - 1);
    graph[e - 1].push_back(s - 1);
  }
  for (int i = 0; i < n; ++i) {
    if ((!marked[i])) {
      if (!dfs_color(i)) {
        cout << -1;
        return 0;
      }
    }
  }
  for (int i = 0; i < 2; i++) {
    cout << color[i].size() << '\n';
    for (int j = 0; j < (int)color[i].size(); ++j)
      cout << color[i][j] + 1 << ' ';
    cout << '\n';
  }
  return 0;
}
