#include <bits/stdc++.h>
using namespace std;
vector<int> Neighbs[100000];
short int Clr[100000];
bool bfs(int root) {
  queue<int> Q;
  Q.push(root);
  Clr[root] = 1;
  while (Q.size()) {
    int front = Q.front();
    Q.pop();
    short int color = -Clr[front];
    for (auto it : Neighbs[front]) {
      if (!Clr[it])
        Clr[it] = color, Q.push(it);
      else if (Clr[it] != color)
        return 0 * printf("-1");
    }
  }
  return 1;
}
int main() {
  int n, m;
  scanf("%i%i", &n, &m);
  while (m--) {
    int u, v;
    scanf("%i%i", &u, &v);
    --u, --v;
    Neighbs[u].push_back(v);
    Neighbs[v].push_back(u);
  }
  for (int i = 0; i < n; i++)
    if (!Clr[i] && !bfs(i)) return 0;
  int count = 0;
  for (int i = 0; i < n; i++)
    if (Clr[i] == -1) count++;
  printf("%i\n", count);
  for (int i = 0; i < n; i++)
    if (Clr[i] == -1) printf("%i ", i + 1);
  printf("\n%i\n", n - count);
  for (int i = 0; i < n; i++)
    if (Clr[i] == 1) printf("%i ", i + 1);
}
