#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int N, M;
vector<int> G[MAXN], A, B;
int boje[MAXN];
bool dfs(int v) {
  for (int i = 0; i < G[v].size(); i++) {
    if (boje[G[v][i]]) {
      if (boje[G[v][i]] + boje[v] != 3) return 0;
    } else {
      boje[G[v][i]] = 3 - boje[v];
      if (!dfs(G[v][i])) return 0;
    }
  }
  return 1;
}
int main(void) {
  scanf("%d%d", &N, &M);
  for (int i = 0; i < M; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    x--;
    y--;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  int check = 1;
  for (int i = 0; i < N; i++) {
    if (!boje[i]) {
      boje[i] = 1;
      check &= dfs(i);
    }
  }
  if (!check) {
    printf("-1");
  } else {
    for (int i = 0; i < N; i++) {
      if (boje[i] == 1) {
        A.push_back(i + 1);
      } else {
        B.push_back(i + 1);
      }
    }
    printf("%d\n", A.size());
    for (int i = 0; i < A.size(); i++) {
      printf("%d ", A[i]);
    }
    printf("\n");
    printf("%d\n", B.size());
    for (int i = 0; i < B.size(); i++) {
      printf("%d ", B[i]);
    }
  }
  return 0;
}
