#include <bits/stdc++.h>
using namespace std;
int const N = 1e5 + 10;
int n, m, u, v, belong[N];
vector<int> g[N];
bool dfs(int cur, int color = 0) {
  belong[cur] = color + 1;
  bool ret = true;
  for (int i = 0, to; ret && i < g[cur].size(); i++) {
    to = g[cur][i];
    if (!belong[to])
      ret &= dfs(to, !color);
    else if (belong[to] != !color + 1)
      ret = false;
  }
  return ret;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  bool can = true;
  for (int i = 1; can && i <= n; i++)
    if (!belong[i]) can &= dfs(i);
  if (!can)
    cout << -1 << endl;
  else {
    int cnt1 = 0, cnt2;
    for (int i = 1; i <= n; i++) cnt1 += belong[i] == 1;
    cnt2 = n - cnt1;
    cout << cnt1 << endl;
    for (int i = 1; i <= n; i++)
      if (belong[i] == 1) printf("%d%c", i, "\n "[bool(--cnt1)]);
    cout << cnt2 << endl;
    for (int i = 1; i <= n; i++)
      if (belong[i] == 2) printf("%d%c", i, "\n "[bool(--cnt2)]);
  }
  return 0;
}
