#include <bits/stdc++.h>
using namespace std;
struct point {
  int n;
  int value;
  vector<int> next;
} p[100010];
queue<struct point> q;
int main() {
  int n, m, x, y, flag = 1, t;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &x, &y);
    p[x].next.push_back(y);
    p[x].n++;
    p[y].next.push_back(x);
    p[y].n++;
  }
  for (int i = 1; i <= n; i++) {
    if (!flag) break;
    if (p[i].n && !p[i].value) {
      p[i].value = 1;
      q.push(p[i]);
      while (!q.empty()) {
        for (int j = 0; j < q.front().n; j++) {
          if (!p[q.front().next[j]].value) {
            p[q.front().next[j]].value = q.front().value % 2 + 1;
            q.push(p[q.front().next[j]]);
          } else {
            if (p[q.front().next[j]].value != q.front().value % 2 + 1) {
              flag = 0;
              break;
            }
          }
        }
        q.pop();
      }
    }
  }
  if (flag) {
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      if (p[i].value == 1) ans++;
    }
    printf("%d\n", ans);
    for (int i = 1; i <= n; i++) {
      if (p[i].value == 1) {
        printf("%d ", i);
      }
    }
    printf("\n");
    ans = 0;
    for (int i = 1; i <= n; i++) {
      if (p[i].value == 2) ans++;
    }
    printf("%d\n", ans);
    for (int i = 1; i <= n; i++) {
      if (p[i].value == 2) {
        printf("%d ", i);
      }
    }
  } else {
    printf("-1");
  }
}
