#include <bits/stdc++.h>
using namespace std;
int n, e, a, b;
vector<int> adjList[100000];
int color[100000];
vector<int> black, white;
bool bfs(int here, bool c) {
  if (color[here] != -1) {
    return color[here] == c;
  }
  color[here] = c;
  bool r = true;
  for (int i = 0; i < adjList[here].size(); i++) {
    r = r && bfs(adjList[here][i], !c);
  }
  return r;
}
int main() {
  scanf("%d%d", &n, &e);
  for (int i = 0; i < e; i++) {
    scanf("%d%d", &a, &b);
    a--, b--;
    adjList[a].push_back(b);
    adjList[b].push_back(a);
  }
  memset(color, -1, sizeof(color));
  bool ans = true;
  for (int i = 0; i < n; i++) {
    if (color[i] == -1) ans = ans && bfs(i, 0);
  }
  if (!ans) {
    cout << -1 << endl;
  } else {
    for (int i = 0; i < n; i++) {
      if (color[i] == 0) {
        black.push_back(i + 1);
      } else
        white.push_back(i + 1);
    }
    printf("%d\n", black.size());
    for (int i = 0; i < black.size(); i++) {
      printf("%d", black[i]);
      if (i != black.size() - 1) printf(" ");
    }
    printf("\n");
    printf("%d\n", white.size());
    for (int i = 0; i < white.size(); i++) {
      printf("%d", white[i]);
      if (i != white.size() - 1) printf(" ");
    }
    printf("\n");
  }
  return 0;
}
