#include <bits/stdc++.h>
using namespace std;
vector<int> adj[100010];
int vis[100010];
int flag;
void dfs(int v, int c) {
  vis[v] = c;
  for (int i = 0; i < adj[v].size(); i++) {
    if (!vis[adj[v][i]]) {
      dfs(adj[v][i], c == 1 ? 2 : 1);
    } else if (vis[adj[v][i]] != (c == 1 ? 2 : 1)) {
      flag = 1;
    }
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  flag = 0;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  memset(vis, 0, sizeof vis);
  int first = 1;
  int numAdj = 0;
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      dfs(i, 1);
    }
  }
  int sizes[3];
  memset(sizes, 0, sizeof sizes);
  if (flag || numAdj > 1) {
    cout << -1 << "\n";
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    sizes[vis[i]]++;
  }
  cout << sizes[1] << "\n";
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 1) cout << i << " ";
  }
  cout << "\n";
  cout << sizes[2] << "\n";
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 2) cout << i << " ";
  }
  cout << "\n";
}
