#include <bits/stdc++.h>
using namespace std;
const int xn = 1e5 + 20;
int n, m, a[xn], r, b;
vector<int> adj[xn];
bool f;
void dfs(int v, int par) {
  if (v == par) {
    a[v] = 1;
  } else {
    a[v] = 3 - a[par];
  }
  for (int i = 0; i < adj[v].size(); i++) {
    int u = adj[v][i];
    if (a[u] == a[v]) {
      f = 1;
    } else if (a[u] == 0)
      dfs(u, v);
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0, d, c; i < m; i++) {
    cin >> c >> d;
    c--;
    d--;
    adj[c].push_back(d);
    adj[d].push_back(c);
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) dfs(i, i);
    if (f) return cout << -1, 0;
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == 1) r++;
    if (a[i] == 2) b++;
  }
  cout << r << "\n";
  for (int i = 0; i < n; i++)
    if (a[i] == 1) cout << i + 1 << ' ';
  cout << "\n" << b << "\n";
  for (int i = 0; i < n; i++)
    if (a[i] == 2) cout << i + 1 << ' ';
  return 0;
}
