#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000;
int a, b, m, n, C[MAXN], I[MAXN];
queue<int> Q;
vector<int> A, B, E[MAXN];
int main() {
  cin >> n >> m;
  while (m--) {
    cin >> a >> b;
    --a;
    --b;
    E[a].push_back(b);
    E[b].push_back(a);
    I[a] = I[b] = 1;
  }
  for (int i = 0; i < n; ++i) {
    C[i] = -1;
  }
  for (int i = 0; i < n; ++i) {
    if (C[i] > -1 || !I[i]) {
      continue;
    }
    C[i] = 1;
    Q.push(i);
    while (!Q.empty()) {
      a = Q.front();
      Q.pop();
      for (auto j : E[a]) {
        if (C[j] == -1) {
          C[j] = !C[a];
          Q.push(j);
        } else if (C[j] == C[a]) {
          cout << -1 << endl;
          return 0;
        }
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    if (C[i] == 0) {
      A.push_back(i);
    } else if (C[i] == 1) {
      B.push_back(i);
    }
  }
  cout << A.size() << endl;
  for (auto i : A) {
    cout << i + 1 << " ";
  }
  cout << endl;
  cout << B.size() << endl;
  for (auto i : B) {
    cout << i + 1 << " ";
  }
  cout << endl;
  return 0;
}
