#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b) {
  long long ret = 1;
  a %= 1000000007;
  while (b) {
    if (b % 2 == 1) ret = (ret * a) % 1000000007;
    a = (a * a) % 1000000007;
    b /= 2;
  }
  return ret;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int vis[100010], col[100010];
vector<int> adj[100010];
vector<int> ans[2];
bool dfs(int color, int cur) {
  vis[cur] = 1;
  col[cur] = color;
  ans[color].push_back(cur);
  bool ans = true;
  for (int i = 0; i < adj[cur].size(); i++) {
    if (vis[adj[cur][i]] == 1) {
      if (1 - color != col[adj[cur][i]]) ans = false;
      continue;
    }
    ans &= dfs(1 - color, adj[cur][i]);
  }
  return ans;
}
int main() {
  int n, m, x, y;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &x, &y);
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  bool anss = true;
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 0) {
      anss &= dfs(0, i);
    }
  }
  if (anss == false) {
    puts("-1");
    return 0;
  }
  for (int i = 0; i < 2; i++) {
    printf("%d\n", ans[i].size());
    for (int j = 0; j < ans[i].size(); j++) printf("%d ", ans[i][j]);
    printf("\n");
  }
  return 0;
}
