#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  return x * f;
}
vector<int> vc[2];
vector<int> g[100010];
int mark[100010];
bool dfs(int v, int color = 2) {
  mark[v] = color;
  vc[color - 1].push_back(v);
  for (int u : g[v]) {
    if (!mark[u] && dfs(u, 3 - color)) return 1;
    if (mark[u] != 3 - color) return 1;
  }
  return 0;
}
int main() {
  int n, m;
  n = read();
  m = read();
  for (int i = 0; i < m; i++) {
    int u = read() - 1;
    int v = read() - 1;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 0; i < n; i++)
    if (!mark[i]) {
      if (g[i].empty()) continue;
      if (dfs(i)) {
        cout << -1 << endl;
        return 0;
      }
    }
  for (int i = 0; i < 2; i++) {
    cout << vc[i].size() << endl;
    for (int v : vc[i]) cout << v + 1 << " ";
    cout << endl;
  }
}
