#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
template <typename T>
using vv = vector<vector<T>>;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
inline int cind() {
  int a;
  scanf("%d", &a);
  return a;
}
inline double cindl() {
  double a;
  scanf("%lf", &a);
  return a;
}
vector<int> used(2e5, 0);
vector<int> first;
vector<int> second;
vector<vector<int>> g(2e5);
void dfs(int v, int c) {
  used[v] = c;
  if (c == 1) {
    first.push_back(v);
  } else {
    second.push_back(v);
  }
  for (auto to : g[v]) {
    if (used[to] == used[v]) {
      cout << -1 << endl;
      exit(0);
    }
    if (!used[to]) {
      if (c == 1) {
        dfs(to, 2);
      } else {
        dfs(to, 1);
      }
    }
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  g.resize(n);
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 0; i < n; ++i) {
    if (!used[i]) {
      dfs(i, 1);
    }
  }
  cout << first.size() << endl;
  for (auto v : first) {
    cout << v + 1 << " ";
  }
  cout << endl;
  cout << second.size() << endl;
  for (auto v : second) {
    cout << v + 1 << " ";
  }
}
