#include <bits/stdc++.h>
using namespace std;
class GRAPH {
 public:
  int to[410000], next[410000];
  int head[201000];
  int cnt;
  GRAPH() { cnt = 1; }
  void add(int x, int y) {
    next[cnt] = head[x];
    to[cnt] = y;
    head[x] = cnt++;
  }
};
int col[201000];
GRAPH g;
int n, m;
int cnt[4];
bool dfs(int pos, int c) {
  cnt[c]++;
  col[pos] = c;
  for (register int i = g.head[pos]; i; i = g.next[i])
    if (col[g.to[i]] == col[pos])
      return false;
    else if (col[g.to[i]] == 0) {
      if (!dfs(g.to[i], 3 - c)) return false;
    }
  return true;
}
int main() {
  int x, y;
  cin >> n >> m;
  for (register int i = (0); i < (m); i++) {
    scanf("%d%d", &x, &y);
    g.add(x, y);
    g.add(y, x);
  }
  for (register int i = (1); i < (n + 1); i++)
    if (col[i] == 0)
      if (!dfs(i, 2)) {
        cout << -1;
        return 0;
      }
  cout << cnt[1] << endl;
  for (register int i = (1); i < (n + 1); i++)
    if (col[i] == 1) cout << i << ' ';
  cout << endl;
  cout << cnt[2] << endl;
  for (register int i = (1); i < (n + 1); i++)
    if (col[i] == 2) cout << i << ' ';
  cout << endl;
  return ~~(0 ^ 0 ^ 0);
}
