#include <bits/stdc++.h>
using namespace std;
int n, m, bp, bc;
vector<int> g[100001], p, c;
int b[100001];
bool yaman;
void dfs(int s, int k) {
  b[s] = k;
  if (k == 1) {
    p.push_back(s);
    bp++;
  } else {
    c.push_back(s);
    bc++;
  }
  for (int i = 0; i < g[s].size(); i++) {
    if (b[g[s][i]] == 2)
      dfs(g[s][i], 1 - k);
    else {
      if (b[g[s][i]] == b[s]) yaman = true;
    }
  }
}
int main() {
  yaman = false;
  bp = bc = 0;
  int x, y;
  cin >> n >> m;
  fill(b, b + 100001, 2);
  for (int i = 1; i <= m; i++) {
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    if (b[i] == 2) dfs(i, 0);
  }
  if (yaman) {
    cout << -1;
    return 0;
  }
  cout << bp << endl;
  for (int i = 0; i < p.size(); i++) {
    cout << p[i] << " ";
  }
  cout << endl;
  cout << bc << endl;
  for (int i = 0; i < c.size(); i++) {
    cout << c[i] << " ";
  }
}
