#include <bits/stdc++.h>
using namespace std;
vector<int> G[100005];
int s[100005];
void addEdge(int u, int v) {
  G[u].push_back(v);
  G[v].push_back(u);
}
bool flag;
int n, m;
void dfs(int k, int color) {
  s[k] = color;
  int len = G[k].size();
  for (int i = 0; i < len; i++) {
    if (s[G[k][i]] == 0)
      dfs(G[k][i], 3 - color);
    else {
      if (s[G[k][i]] == color) {
        flag = true;
        return;
      }
    }
  }
}
int main() {
  for (int i = 0; i <= 100000; i++) G[i].clear();
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    addEdge(x - 1, y - 1);
  }
  flag = false;
  memset(s, 0, sizeof s);
  for (int i = 0; i < n; i++) {
    if (s[i] == 0) {
      dfs(i, 1);
    }
  }
  if (flag) {
    printf("-1\n");
    return 0;
  } else {
    int num1 = 0, num2 = 0;
    for (int i = 0; i < n; i++)
      if (s[i] == 1)
        num1++;
      else
        num2++;
    printf("%d\n", num1);
    for (int i = 0; i < n; i++)
      if (s[i] == 1) printf("%d ", i + 1);
    printf("\n");
    printf("%d\n", num2);
    for (int i = 0; i < n; i++)
      if (s[i] == 2) printf("%d ", i + 1);
    printf("\n");
  }
}
