#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
vector<int> graph[N + 100];
int vis[N + 100];
vector<int> one, two;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  queue<int> q;
  bool flag = true;
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      q.push(i);
      vis[i] = 1;
      one.push_back(i);
      while (!q.empty()) {
        int u = q.front();
        q.pop();
        for (auto it : graph[u]) {
          if (!vis[it]) {
            q.push(it);
            if (vis[u] == 1) {
              vis[it] = 2;
              two.push_back(it);
            } else {
              vis[it] = 1;
              one.push_back(it);
            }
          }
          if (vis[it] == vis[u]) flag = false;
        }
      }
    }
  }
  if (!flag) {
    printf("-1\n");
  } else {
    printf("%d\n", (int)one.size());
    for (auto it : one) {
      printf("%d ", it);
    }
    printf("\n");
    printf("%d\n", (int)two.size());
    for (auto it : two) {
      printf("%d ", it);
    }
    printf("\n");
  }
}
