#include <bits/stdc++.h>
template <typename C>
int sz(const C &c) {
  return c.size();
}
using namespace std;
bool dfs(const vector<vector<int>> &g, int u, int n, vector<int> &s) {
  bool ok = true;
  s[u] = n % 2 + 1;
  for (int i = 0; i < sz(g[u]) && ok; ++i) {
    if (s[g[u][i]] != 0) {
      ok = s[g[u][i]] != s[u];
    } else {
      ok = dfs(g, g[u][i], n + 1, s);
    }
  }
  return ok;
}
int main() {
  iostream::sync_with_stdio(false);
  int n;
  cin >> n;
  int m;
  cin >> m;
  vector<vector<int>> g(n);
  for (int i = 0; i < m; ++i) {
    int u;
    cin >> u;
    int v;
    cin >> v;
    g[u - 1].push_back(v - 1);
    g[v - 1].push_back(u - 1);
  }
  vector<int> s(n);
  bool ok = true;
  for (int i = 0; i < n && ok; ++i) {
    if (s[i] == 0) {
      ok = dfs(g, i, 0, s);
    }
  }
  vector<int> r1;
  vector<int> r2;
  for (int i = 0; i < sz(s); ++i) {
    if (s[i] == 1) {
      r1.push_back(i + 1);
    } else {
      r2.push_back(i + 1);
    }
  }
  if (!ok) {
    cout << "-1\n";
  } else {
    cout << sz(r1) << "\n";
    for (auto e : r1) {
      cout << e << " ";
    }
    cout << "\n";
    cout << sz(r2) << "\n";
    for (auto e : r2) {
      cout << e << " ";
    }
    cout << "\n";
  }
}
