#include <bits/stdc++.h>
using namespace std;
vector<int> adj[100001];
int n, m;
vector<int> ans1;
vector<int> ans2;
int colour[100001];
bool ok = 1;
vector<int> visited(100001);
void dfs(int v, int p = -1, int col = 0) {
  visited[v] = 1;
  if (ok == 0) return;
  colour[v] = col;
  for (auto it : adj[v]) {
    if (it == p)
      continue;
    else if (visited[it]) {
      if (colour[v] == colour[it]) ok = 0;
    } else {
      dfs(it, v, col ^ 1);
    }
  }
}
void solve() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    if (!visited[i]) dfs(i);
  }
  if (ok == 0) {
    cout << -1 << endl;
    return;
  }
  for (int i = 1; i <= n; i++) {
    if (colour[i] == 0)
      ans1.push_back(i);
    else
      ans2.push_back(i);
  }
  cout << ans1.size() << endl;
  for (auto it : ans1) cout << it << " ";
  cout << endl;
  cout << ans2.size() << endl;
  for (auto it : ans2) cout << it << " ";
  cout << endl;
}
int main() {
  int t = 1;
  while (t--) solve();
  return 0;
}
