#include <bits/stdc++.h>
using namespace std;
char color[100005];
queue<int> Q;
vector<int> adj[100005];
bool bicolor;
int parity = 1;
void BFS(int sc) {
  while (!Q.empty()) Q.pop();
  color[sc] = parity + 1;
  Q.push(sc);
  int u, v, i;
  while (!Q.empty()) {
    u = Q.front();
    Q.pop();
    for (i = 0; i < adj[u].size(); i++) {
      v = adj[u][i];
      if (color[v] == 0) {
        color[v] = 3 - color[u];
        Q.push(v);
      } else {
        if (color[v] == color[u]) {
          bicolor = 0;
          return;
        }
      }
    }
  }
}
int main() {
  int N, M, i, j, a, b;
  scanf("%d%d", &N, &M);
  for (i = 0; i <= N; i++) {
    adj[i].clear();
  }
  for (i = 0; i < M; i++) {
    scanf("%d%d", &a, &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  bicolor = 1;
  for (i = 1; i <= N; i++) {
    if (!color[i]) {
      parity = (parity + 1) % 2;
      BFS(i);
      if (!bicolor) break;
    }
  }
  if (!bicolor) {
    puts("-1");
  } else {
    int cnt1 = 0, cnt2 = 0;
    for (i = 1; i <= N; i++) {
      if (color[i] == 1) cnt1++;
      if (color[i] == 2) cnt2++;
    }
    printf("%d\n", cnt1);
    bool first = 1;
    for (i = 1; i <= N; i++) {
      if (color[i] == 1) {
        if (first) {
          first = 0;
        } else
          printf(" ");
        printf("%d", i);
      }
    }
    puts("");
    printf("%d\n", cnt2);
    first = 1;
    for (i = 1; i <= N; i++) {
      if (color[i] == 2) {
        if (first) {
          first = 0;
        } else
          printf(" ");
        printf("%d", i);
      }
    }
    puts("");
  }
  return 0;
}
