#include <bits/stdc++.h>
using namespace std;
int N, M;
vector<int> edge[100001];
int val[100001];
vector<int> ans[2];
void dfs(int i, int fi) {
  if (val[i] != 0 && fi != val[i]) {
    cout << "-1\n";
    exit(0);
  }
  if (val[i] != 0 && fi == val[i]) {
    return;
  }
  val[i] = fi;
  ans[(fi + 1) / 2].push_back(i);
  for (int j = 0; j < edge[i].size(); j++) {
    dfs(edge[i][j], -fi);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  if (fopen("cf688c.in", "r")) {
    freopen("cf688c.in", "r", stdin);
    freopen("cf688c.out", "w", stdout);
  }
  cin >> N >> M;
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  for (int i = 0; i < N; i++) {
    if (val[i] == 0) {
      if (ans[0].size() == 0) {
        dfs(i, -1);
      } else {
        dfs(i, 1);
      }
    }
  }
  if (ans[0].size() == 0 || ans[1].size() == 0) {
    cout << "-1\n";
    return 0;
  }
  cout << ans[0].size() << '\n';
  for (int i = 0; i < ans[0].size(); i++) {
    cout << ans[0][i] + 1 << ' ';
  }
  cout << '\n';
  cout << ans[1].size() << '\n';
  for (int i = 0; i < ans[1].size(); i++) {
    cout << ans[1][i] + 1 << ' ';
  }
  cout << '\n';
  return 0;
}
