#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > v;
vector<int> vis;
queue<int> pro;
vector<int> oe;
int alpha = 0;
void bfs() {
  while (pro.size() != 0) {
    int k = pro.front();
    pro.pop();
    for (int i = 0; i < v[k].size(); i++) {
      if (vis[v[k][i]] == 0) {
        pro.push(v[k][i]);
        oe[v[k][i]] = oe[k] + 1;
        vis[v[k][i]] = 1;
      }
    }
  }
  for (int i = alpha; i < vis.size(); i++) {
    if (vis[i] == 0) {
      vis[i] = 1;
      if (v[i].size() != 0) {
        pro.push(i);
        alpha = i;
        bfs();
        break;
      }
    }
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  oe.resize(n, 0);
  v.resize(n);
  vis.resize(n, 0);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    v[a - 1].push_back(b - 1);
    v[b - 1].push_back(a - 1);
  }
  vis[0] = 1;
  pro.push(0);
  bfs();
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < v[i].size(); j++) {
      if ((oe[i] + oe[v[i][j]]) % 2 == 0) {
        cout << -1 << endl;
        return 0;
      }
    }
  }
  int a = 0, b = 0;
  for (int i = 0; i < n; i++) {
    if (oe[i] % 2 == 0) {
      a++;
    } else {
      b++;
    }
  }
  cout << a << endl;
  for (int i = 0; i < n; i++) {
    if (oe[i] % 2 == 0) {
      cout << i + 1 << " ";
    }
  }
  cout << endl;
  cout << b << endl;
  for (int i = 0; i < n; i++) {
    if (oe[i] % 2 == 1) {
      cout << i + 1 << " ";
    }
  }
  cout << endl;
}
