#include <bits/stdc++.h>
using namespace std;
bool flag;
int v, e, a, b;
int color[100010], visi[100010];
vector<int> vec[2], graph[100010];
void dfs(int u, int c) {
  if (visi[u] && c != color[u]) flag = true;
  if (visi[u]) return;
  visi[u] = 1;
  color[u] = c;
  vec[c ^ 1].push_back(u);
  for (int i = 0; i < graph[u].size(); i++) {
    int t = graph[u][i];
    dfs(t, c ^ 1);
  }
}
int main() {
  flag = false;
  memset(color, 0, sizeof color);
  memset(visi, 0, sizeof visi);
  cin >> v >> e;
  for (int i = 0; i < e; i++) {
    cin >> a >> b;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  for (int i = 1; i <= v; i++) {
    if (!color[i]) {
      dfs(i, 0);
    }
  }
  if (flag) {
    puts("-1");
    return 0;
  }
  for (int i = 0; i < 2; i++) {
    cout << vec[i].size() << endl;
    for (auto c : vec[i]) {
      cout << c << " ";
    }
    puts("");
  }
  return 0;
}
