#include <bits/stdc++.h>
using namespace std;
int n, m;
int t[(100000 + 5)], cn1, cn2;
std::vector<int> g[(100000 + 5)];
bool dfs(int r, int fa, int f) {
  t[r] = f;
  if (f == 1)
    cn1++;
  else
    cn2++;
  for (int i = 0; i < g[r].size(); i++) {
    if (g[r][i] == fa) continue;
    if (t[g[r][i]] != 0 && t[g[r][i]] == f) return false;
    if (t[g[r][i]] == 0 && dfs(g[r][i], r, -1 * f) == false) return false;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  memset(t, 0, sizeof(t));
  for (int i = 0; i < n + 3; i++) {
    g[i].clear();
  }
  int u, v;
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  cn1 = 0;
  cn2 = 0;
  bool flag = true;
  for (int i = 1; i <= n; i++) {
    if (t[i] != 0) continue;
    if (dfs(i, -1, 1) == false) {
      flag = false;
      break;
    }
  }
  if (flag == true) {
    cout << cn1 << endl;
    for (int i = 1; i <= n; i++) {
      if (t[i] == -1) continue;
      cout << i << " ";
    }
    cout << endl;
    cout << cn2 << endl;
    for (int i = 1; i <= n; i++) {
      if (t[i] == 1) continue;
      cout << i << " ";
    }
    cout << endl;
  } else {
    cout << "-1" << endl;
  }
  return 0;
}
