#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, M = N * 2;
int h[N], ne[M], e[M], idx;
int n, m, col[N];
void add(int a, int b) {
  e[idx] = b, ne[idx] = h[a], h[a] = idx++;
  e[idx] = a, ne[idx] = h[b], h[b] = idx++;
}
bool dfs(int u, int c) {
  col[u] = c;
  for (int i = h[u]; ~i; i = ne[i]) {
    if (!col[e[i]]) {
      if (!dfs(e[i], 3 - c)) return false;
    } else if (col[e[i]] == c)
      return false;
  }
  return true;
}
int main() {
  cin >> n >> m;
  memset(h, -1, sizeof h);
  for (int i = 1; i <= m; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    add(a, b);
  }
  for (int i = 1; i <= n; i++) {
    if (!col[i]) {
      if (!dfs(i, 1)) {
        cout << -1 << endl;
        return 0;
      }
    }
  }
  int cnt1 = 0, cnt2 = 0;
  for (int i = 1; i <= n; i++)
    if (col[i] == 1)
      cnt1++;
    else
      cnt2++;
  printf("%d\n", cnt1);
  for (int i = 1; i <= n; i++) {
    if (col[i] == 1) printf("%d ", i);
  }
  printf("\n");
  printf("%d\n", cnt2);
  for (int i = 1; i <= n; i++)
    if (col[i] == 2) printf("%d ", i);
  return 0;
}
