#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
vector<int> G[maxn];
int v;
int color[maxn];
int a[maxn];
int b[maxn];
bool dfs(int v, int c) {
  color[v] = c;
  for (int i = 0; i < G[v].size(); i++) {
    if (color[G[v][i]] == c) return false;
    if (color[G[v][i]] == 0 && !dfs(G[v][i], -c)) return false;
  }
  return true;
}
bool solve() {
  for (int i = 1; i <= v; i++) {
    if (color[i] == 0) {
      if (!dfs(i, 1)) return false;
    }
  }
  return true;
}
int main() {
  int e;
  while (~scanf("%d%d", &v, &e)) {
    memset(color, 0, sizeof(color));
    for (int i = 1; i <= v; i++) G[i].clear();
    for (int i = 0; i < e; i++) {
      int x, y;
      scanf("%d%d", &x, &y);
      G[x].push_back(y);
      G[y].push_back(x);
    }
    int k1 = 0, k2 = 0;
    if (solve()) {
      for (int i = 1; i <= v; i++) {
        if (color[i] == -1) {
          a[k1++] = i;
        } else
          b[k2++] = i;
      }
      printf("%d\n", k1);
      printf("%d", a[0]);
      for (int i = 1; i < k1; i++) printf(" %d", a[i]);
      printf("\n");
      printf("%d\n", k2);
      printf("%d", b[0]);
      for (int i = 1; i < k2; i++) printf(" %d", b[i]);
      printf("\n");
    } else
      printf("-1\n");
  }
}
