#include <bits/stdc++.h>
using namespace std;
vector<vector<long long int> > graph;
vector<bool> visited;
vector<long long int> st1;
vector<long long int> st2;
vector<bool> clr;
bool ans;
void dfs(long long int vertex, long long int prev, bool tmp) {
  visited[vertex] = 1;
  clr[vertex] = tmp;
  for (auto itr = graph[vertex].begin(); itr != graph[vertex].end(); itr++) {
    if (*itr == prev) continue;
    if (!visited[*itr])
      dfs(*itr, vertex, !tmp);
    else if (clr[*itr] == clr[vertex])
      ans = 0;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  long long int n, m, u, v;
  cin >> n >> m;
  graph = vector<vector<long long int> >(n + 1);
  visited = vector<bool>(n + 1, 0);
  clr = vector<bool>(n + 1, 0);
  for (long long int i = 0; i < m; i++) {
    cin >> u >> v;
    graph[u].emplace_back(v);
    graph[v].emplace_back(u);
  }
  ans = 1;
  bool tp = 0;
  for (long long int i = 1; i <= n && ans; i++) {
    if (!visited[i]) {
      dfs(i, 0, tp);
      tp = !tp;
    }
  }
  long long int sz1, sz2;
  if (!ans) {
    cout << -1 << '\n';
  } else {
    for (long long int i = 1; i <= n; i++) {
      if (clr[i])
        st1.emplace_back(i);
      else
        st2.emplace_back(i);
    }
    sz1 = st1.size();
    cout << sz1 << '\n';
    for (long long int i = 0; i < sz1; i++) cout << st1[i] << " ";
    cout << '\n';
    sz2 = st2.size();
    cout << sz2 << '\n';
    for (long long int i = 0; i < sz2; i++) cout << st2[i] << " ";
    cout << '\n';
  }
  return 0;
}
