#include <bits/stdc++.h>
using namespace std;
vector<int> e[100010], a, b;
int f[100010];
int vis[100010];
bool dfs(int x, int s) {
  vis[x] = 1;
  f[x] = s;
  for (int i = 0; i < e[x].size(); i++) {
    if (!vis[e[x][i]] && !dfs(e[x][i], s ^ 1)) return 0;
    if (vis[e[x][i]] && f[e[x][i]] == s) return 0;
  }
  return 1;
}
int main() {
  int n, m, u, v;
  cin >> n >> m;
  while (m--) {
    cin >> u >> v;
    e[u].push_back(v);
    e[v].push_back(u);
  }
  for (int i = 1; i <= n; i++)
    if (!vis[i] && !dfs(i, 0)) {
      puts("-1");
      return 0;
    }
  for (int i = 1; i <= n; i++) {
    if (f[i])
      a.push_back(i);
    else
      b.push_back(i);
  }
  cout << a.size() << endl;
  for (int i = 0; i < a.size(); i++) cout << a[i] << " ";
  puts("");
  cout << b.size() << endl;
  for (int i = 0; i < b.size(); i++) cout << b[i] << " ";
  return 0;
}
