#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 * 1000 + 10;
bool mark[MAXN];
bool color[MAXN];
vector<int> adj[MAXN];
bool dfs(int v, bool c) {
  mark[v] = 1;
  color[v] = c;
  for (int i = 0; i < adj[v].size(); i++) {
    int u = adj[v][i];
    if (mark[u] != 1) {
      bool r = dfs(u, !c);
      if (r == 0) return 0;
    }
    if (color[u] == c) return 0;
  }
  return 1;
}
int main() {
  int n, m;
  cin >> n >> m;
  int u, v;
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (!mark[i]) {
      if (!dfs(i, 0)) {
        cout << -1;
        return 0;
      }
    }
  }
  vector<int> h, h2;
  for (int i = 1; i <= n; i++) {
    if (color[i]) {
      h.push_back(i);
    } else {
      h2.push_back(i);
    }
  }
  cout << h.size() << '\n';
  for (int i = 0; i < h.size(); i++) {
    cout << h[i] << ' ';
  }
  cout << '\n';
  cout << h2.size() << '\n';
  for (int i = 0; i < h2.size(); i++) {
    cout << h2[i] << ' ';
  }
}
