#include <bits/stdc++.h>
using namespace std;
int num, q[200005], ne[200005], head[100005];
int col[100005], n, m, x, y, num1, num2, flag;
void addnum(int x, int y) {
  num++;
  q[num] = y;
  ne[num] = head[x];
  head[x] = num;
}
void dfs(int t, int fa, int type) {
  if (type == 1) {
    col[t] = 1;
    num1++;
  } else {
    col[t] = 2;
    num2++;
  }
  for (int i = head[t]; i; i = ne[i]) {
    if (q[i] == fa) continue;
    if (col[q[i]] == col[t]) {
      flag = -1;
      return;
    } else if (col[q[i]] == 0)
      dfs(q[i], t, 3 - type);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    addnum(x, y);
    addnum(y, x);
  }
  for (int i = 1; i <= n; i++) {
    if (head[i] == 0 || col[i] != 0) continue;
    dfs(i, 0, 1);
    if (flag == -1) {
      printf("-1");
      return 0;
    }
  }
  printf("%d\n", num1);
  for (int i = 1; i <= n; i++)
    if (col[i] == 1) printf("%d ", i);
  printf("\n");
  printf("%d\n", num2);
  for (int i = 1; i <= n; i++)
    if (col[i] == 2) printf("%d ", i);
  printf("\n");
}
