#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> v[n];
  queue<int> q;
  int type[n];
  int a, b;
  for (int i = 0; i < m; ++i) {
    cin >> a >> b;
    a--;
    b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  for (int i = 0; i < n; ++i) {
    type[i] = -1;
  }
  for (int i = 0; i < n; ++i) {
    if (type[i] != -1) continue;
    type[i] = 0;
    q.push(i);
    while (!q.empty()) {
      int c = q.front();
      q.pop();
      for (int i = 0; i < v[c].size(); ++i) {
        if (type[v[c][i]] == -1) {
          q.push(v[c][i]);
          type[v[c][i]] = 1 - type[c];
        } else {
          if (type[v[c][i]] == type[c]) {
            cout << -1;
            return 0;
          }
        }
      }
    }
  }
  vector<int> n1, n2;
  for (int i = 0; i < n; ++i) {
    if (!v[i].empty())
      if (type[i] == 1)
        n1.push_back(i + 1);
      else
        n2.push_back(i + 1);
  }
  cout << n1.size() << endl;
  for (int i = 0; i < n1.size(); ++i) {
    cout << n1[i] << " ";
  }
  cout << endl;
  cout << n2.size() << endl;
  for (int i = 0; i < n2.size(); ++i) {
    cout << n2[i] << " ";
  }
  return 0;
}
