#include <bits/stdc++.h>
using namespace std;
vector<int> g[100010];
int us[100010], w[3][100010], z1, z2, dooc;
void dfs(int v, int in = 1) {
  us[v] = in;
  for (int i = 0; i < g[v].size(); i++)
    if (us[g[v][i]] == 0) {
      dfs(g[v][i], (in == 1 ? 2 : 1));
    } else if (us[g[v][i]] == in) {
      dooc = -1;
    }
}
int main() {
  int n, m, u, v, i;
  cin >> n >> m;
  while (m--) {
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (i = 1; i <= n; i++)
    if (!us[i]) dfs(i);
  if (dooc == -1) {
    cout << -1;
    return 0;
  }
  for (i = 1; i <= n; i++) {
    if (us[i] == 1) w[1][++z1] = i;
    if (us[i] == 2) w[2][++z2] = i;
  }
  cout << z1 << "\n";
  for (i = 1; i <= z1; i++) cout << w[1][i] << " ";
  cout << "\n" << z2 << "\n";
  for (i = 1; i <= z2; i++) cout << w[2][i] << " ";
}
