#include <bits/stdc++.h>
using namespace std;
int head[100010], to[2 * 100010], nxt[2 * 100010], vst[100010], cnt[3];
bool dfs(int u, int id) {
  if (head[u] == -1) return true;
  vst[u] = id;
  cnt[id]++;
  for (int edge = head[u]; edge != -1; edge = nxt[edge]) {
    int v = to[edge];
    if (vst[v]) {
      if (vst[v] == id) return false;
      continue;
    }
    if (!dfs(v, 3 - id)) return false;
  }
  return true;
}
int main() {
  int N, M, i, u, v;
  scanf("%d %d", &N, &M);
  int edge = 0;
  memset(head, -1, sizeof(head));
  for (i = 0; i < M; i++) {
    scanf("%d %d", &u, &v);
    nxt[edge] = head[u];
    to[edge] = v;
    head[u] = edge++;
    nxt[edge] = head[v];
    to[edge] = u;
    head[v] = edge++;
  }
  for (i = 1; i <= N; i++) {
    if (vst[i]) continue;
    if (!dfs(i, 1)) {
      puts("-1");
      return 0;
    }
  }
  for (int id = 1; id <= 2; id++) {
    printf("%d\n", cnt[id]);
    for (i = 1; i <= N; i++) {
      if (vst[i] == id) printf("%d ", i);
    }
    puts("");
  }
  return 0;
}
