#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > v(100010);
vector<int> vi(100010, -1);
vector<int> a, b;
void dfs(int c, int p, int t) {
  if (vi[c] != -1) {
    if (vi[c] != t) {
      cout << "-1" << endl;
      exit(0);
    } else
      return;
  }
  vi[c] = t;
  if (t == 1)
    a.push_back(c);
  else
    b.push_back(c);
  int i;
  for (i = 0; i < v[c].size(); i++) {
    if (v[c][i] != p) dfs(v[c][i], c, (t + 1) % 2);
  }
}
int main() {
  int n, m, i, x, y;
  cin >> n >> m;
  for (i = 0; i < m; i++) {
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (i = 1; i <= n; i++) {
    if (vi[i] == -1) {
      dfs(i, -1, 0);
    }
  }
  cout << a.size() << endl;
  for (i = 0; i < a.size(); i++) cout << a[i] << " ";
  cout << endl;
  cout << b.size() << endl;
  for (i = 0; i < b.size(); i++) cout << b[i] << " ";
  cout << endl;
  return 0;
}
