#include <bits/stdc++.h>
using namespace std;
vector<int> v[100000];
vector<int> multitude[2];
int f[100000] = {};
bool dfs(int d, int color = 0) {
  multitude[color].push_back(d);
  f[d] = 1 + color;
  for (auto u : v[d]) {
    if (!f[u] && dfs(u, 1 - color)) return 1;
    if (f[u] != 1 + 1 - color) return 1;
  }
  return 0;
}
int main() {
  int n, m, i;
  cin >> n >> m;
  for (i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  for (i = 0; i < n; i++) {
    if (!f[i] && dfs(i)) {
      cout << "-1";
      return 0;
    }
  }
  for (i = 0; i < 2; i++) {
    cout << multitude[i].size() << "\n";
    for (auto v : multitude[i]) cout << v + 1 << " ";
    cout << "\n";
  }
}
