#include <bits/stdc++.h>
using namespace std;
const int MXN = 1e6 + 1;
const int MAXN = 1e4 + 1;
const long long INF = 1e9 + 7;
const int MOD = 1e6 * 5;
const double EPS = 1e-9;
long long n, m, ans;
long long was[MXN], used[MXN];
vector<int> g[MXN], a, b;
void dfs(int v, int x) {
  was[v] = x;
  if (x == 1)
    a.push_back(v);
  else
    b.push_back(v);
  used[v] = 1;
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i];
    if (x == 1)
      ans = -1;
    else
      ans = 1;
    if (was[to] != ans && was[to] != 0) {
      cout << -1;
      exit(0);
    }
    if (!used[to]) {
      dfs(to, ans);
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (!used[i]) {
      dfs(i, 1);
    }
  }
  cout << a.size() << endl;
  for (int i = 0; i < a.size(); i++) {
    cout << a[i] << ' ';
  }
  cout << endl << b.size() << endl;
  for (int i = 0; i < b.size(); i++) {
    cout << b[i] << ' ';
  }
  return 0;
}
