#include <bits/stdc++.h>
using namespace std;
int n, m, u, v;
vector<int> g[100010];
int color[100010];
bool bfs(int x) {
  queue<int> q;
  q.push(x);
  color[x] = 1;
  bool flag = true;
  while (!q.empty()) {
    int cur = q.front();
    q.pop();
    for (int adj : g[cur]) {
      if (color[adj] == 0) {
        color[adj] = 3 - color[cur];
        q.push(adj);
      } else {
        if (color[adj] == color[cur]) {
          flag = false;
          break;
        }
      }
    }
  }
  return flag;
}
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 = 1; i <= n; i++) {
    if (color[i] == 0) {
      if (!bfs(i)) {
        printf("-1\n");
        return 0;
      }
    }
  }
  vector<int> a, b;
  for (int i = 1; i <= n; i++) {
    if (color[i] == 1)
      a.push_back(i);
    else
      b.push_back(i);
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  printf("%d\n", (int)a.size());
  for (int i : a) printf("%d ", i);
  printf("\n");
  printf("%d\n", (int)b.size());
  for (int i : b) printf("%d ", i);
  printf("\n");
}
