#include <bits/stdc++.h>
using namespace std;
const int maxn = 100500;
const int inf = 2e9;
const double eps = 1e-8;
const int base = 1073676287;
vector<int> edge[maxn];
bool used[maxn];
int color[maxn];
void dfs(int v, int col) {
  used[v] = true;
  color[v] = col;
  int newCol;
  if (col == 1)
    newCol = 2;
  else
    newCol = 1;
  int sz = edge[v].size();
  for (int j = 0; j < sz; j++) {
    int to = edge[v][j];
    if (used[to]) {
      if (color[to] == color[v]) {
        printf("-1\n");
        exit(0);
      }
      continue;
    }
    dfs(to, newCol);
  }
}
int main() {
  srand(time(0));
  int n, m;
  scanf("%d%d", &n, &m);
  for (int j = 0; j < m; j++) {
    int u, v;
    scanf("%d%d", &u, &v);
    --u;
    --v;
    edge[u].push_back(v);
    edge[v].push_back(u);
  }
  for (int j = 0; j < n; j++) {
    if (!used[j]) dfs(j, 1);
  }
  int ans = 0;
  for (int j = 0; j < n; j++)
    if (color[j] == 2) ++ans;
  printf("%d\n", ans);
  for (int j = 0; j < n; j++)
    if (color[j] == 2) printf("%d ", j + 1);
  printf("\n%d\n", n - ans);
  for (int j = 0; j < n; j++)
    if (color[j] != 2) printf("%d ", j + 1);
  return 0;
}
