#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
struct Edge {
  int to;
  Edge* next;
} * edges[MAXN], pool[MAXN * 2], *alloc = pool;
Edge* new_Edge(int from, int to) {
  Edge* ret = alloc++;
  ret->to = to;
  ret->next = edges[from];
  return ret;
}
void add_edge(int from, int to) {
  edges[from] = new_Edge(from, to);
  edges[to] = new_Edge(to, from);
}
int n, m;
int flag[MAXN];
vector<int> ans[3];
bool bfs(int s) {
  queue<int> q;
  q.push(s);
  flag[s] = 1;
  while (!q.empty()) {
    int x = q.front();
    ans[flag[x]].push_back(x);
    for (Edge* i = edges[x]; i; i = i->next) {
      if (!flag[i->to]) {
        flag[i->to] = flag[x] ^ 3;
        q.push(i->to);
      } else if (flag[i->to] == flag[x])
        return false;
    }
    q.pop();
  }
  return true;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    add_edge(u, v);
  }
  for (int i = 1; i <= n; i++)
    if (!flag[i] && !bfs(i)) {
      printf("-1\n");
      return 0;
    }
  for (int i = 1; i <= 2; i++) {
    printf("%d\n", ans[i].size());
    for (auto j : ans[i]) printf("%d ", j);
    printf("\n");
  }
  return 0;
}
