#include <bits/stdc++.h>
using namespace std;
int vis[100005], mark[100005];
vector<int> g[100005];
int prob = 0;
void dfs(int node, int k) {
  mark[node] = k;
  vis[node] = 1;
  for (auto i : g[node]) {
    if (!vis[i]) {
      dfs(i, 1 - k);
    } else {
      if (mark[i] == k) {
        prob = 1;
      }
    }
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d", &u);
    scanf("%d", &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) dfs(i, 0);
  }
  if (prob) {
    cout << "-1";
    return 0;
  }
  int k = 0;
  for (int i = 1; i <= n; i++) {
    if (mark[i] == 1) k++;
  }
  cout << k << "\n";
  for (int i = 1; i <= n; i++) {
    if (mark[i] == 1) cout << i << " ";
  }
  cout << "\n";
  k = 0;
  for (int i = 1; i <= n; i++) {
    if (mark[i] == 0) k++;
  }
  cout << k << "\n";
  for (int i = 1; i <= n; i++) {
    if (mark[i] == 0) cout << i << " ";
  }
  return 0;
}
