#include <bits/stdc++.h>
std::vector<int> g[100010], output[2];
char ans[100010];
bool used[100010], bad;
int n, m, u, v;
void dfs(int x, int deep = 1, char set = 'A') {
  used[x] = true;
  ans[x] = set;
  for (int i = 0; i < g[x].size(); i++) {
    if (ans[x] == ans[g[x][i]] && used[g[x][i]]) {
      bad = true;
      return;
    }
    if (!used[g[x][i]]) {
      dfs(g[x][i], deep + 1, set == 'A' ? 'B' : 'A');
      if (bad) {
        return;
      }
    }
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 0; i < n; i++) {
    if (used[i + 1]) {
      continue;
    }
    dfs(i + 1);
    if (bad) {
      printf("-1");
      return 0;
    }
  }
  for (int i = 0; i < n; i++) {
    if (ans[i + 1] > 0) {
      output[ans[i + 1] - 'A'].push_back(i + 1);
    }
  }
  for (int i = 0; i < 2; i++) {
    printf("%d\n", (int)output[i].size());
    for (int j = 0; j < output[i].size(); j++) {
      printf("%d ", output[i][j]);
    }
    printf("\n");
  }
  return 0;
}
