#include <bits/stdc++.h>
using namespace std;
vector<int> G[100005];
int ans[1000005] = {0};
int main() {
  int n, m, i, idx1 = 0, j;
  scanf("%d%d", &n, &m);
  for (i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  queue<int> q;
  for (i = 1; i <= n; i++) {
    if (ans[i] == 0) {
      q.push(i);
      ans[i] = 1;
      while (!q.empty()) {
        int u = q.front();
        q.pop();
        if (ans[u] == 1) idx1++;
        int si = G[u].size();
        for (j = 0; j < si; j++) {
          int v = G[u][j];
          if (ans[v] == 0) {
            if (ans[u] == 1) {
              ans[v] = 2;
              q.push(v);
            } else {
              ans[v] = 1;
              q.push(v);
            }
          } else if (ans[v] == ans[u]) {
            printf("-1\n");
            return 0;
          }
        }
      }
    }
  }
  printf("%d\n", idx1);
  for (i = 1; i <= n; i++) {
    if (ans[i] == 1) printf("%d ", i);
  }
  printf("\n");
  printf("%d\n", n - idx1);
  for (i = 1; i <= n; i++) {
    if (ans[i] == 2) printf("%d ", i);
  }
  printf("\n");
  return 0;
}
