#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 1e5 + 5;
int ver[N * 2], Next[N * 2], head[N], col[N];
int tot, n, m;
vector<int> Size[3];
bool flag;
void add(int x, int y) {
  ver[++tot] = y;
  Next[tot] = head[x];
  head[x] = tot;
}
void dfs(int x, int color) {
  if (!flag) return;
  col[x] = color;
  Size[color].push_back(x);
  for (int i = head[x]; ~i; i = Next[i]) {
    int &y = ver[i];
    if (!col[y])
      dfs(y, 3 - color);
    else if (col[y] == col[x]) {
      flag = false;
      return;
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  flag = true;
  memset(head, -1, sizeof(head));
  int x, y;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    add(x, y);
    add(y, x);
  }
  for (int i = 1; i <= n && flag; i++) {
    if (!col[i]) dfs(i, 1);
  }
  if (!flag)
    puts("-1");
  else {
    printf("%d\n", Size[1].size());
    int len = Size[1].size();
    for (int i = 0; i < len; i++) {
      printf("%d%c", Size[1][i], i != len - 1 ? ' ' : '\n');
    }
    printf("%d\n", Size[2].size());
    len = Size[2].size();
    for (int i = 0; i < len; i++) {
      printf("%d%c", Size[2][i], i != len - 1 ? ' ' : '\n');
    }
  }
  return 0;
}
