#include <bits/stdc++.h>
using namespace std;
int father[100005 * 2];
int A[100005];
int B[100005];
bool vis[100005];
void init(int n) {
  for (int i = 1; i <= 2 * n + 5; i++) father[i] = i;
}
int getfather(int x) {
  if (x != father[x]) father[x] = getfather(father[x]);
  return father[x];
}
void Union(int x, int y) {
  x = getfather(x);
  y = getfather(y);
  if (x != y) father[y] = x;
}
int same(int x, int y) { return getfather(x) == getfather(y); }
int main() {
  int n, m;
  int x, y;
  scanf("%d%d", &n, &m);
  int flag = 1;
  init(n);
  int a, b;
  scanf("%d%d", &a, &b);
  vis[a] = vis[b] = 1;
  Union(a, b + n);
  Union(a + n, b);
  m--;
  while (m--) {
    scanf("%d%d", &x, &y);
    vis[x] = vis[y] = 1;
    if (same(x, y))
      flag = 0;
    else {
      Union(x, y + n);
      Union(x + n, y);
    }
  }
  if (flag) {
    int ans1 = 0;
    int ans2 = 0;
    for (int i = 1; i <= n; i++) {
      if (vis[i] && getfather(i) <= n) A[ans1++] = i;
      if (vis[i] && getfather(i) > n) B[ans2++] = i;
    }
    printf("%d\n", ans1);
    printf("%d", A[0]);
    for (int i = 1; i < ans1; i++) printf(" %d", A[i]);
    printf("\n");
    printf("%d\n", ans2);
    printf("%d", B[0]);
    for (int i = 1; i < ans2; i++) printf(" %d", B[i]);
    printf("\n");
  } else
    printf("-1\n");
  return 0;
}
