#include <bits/stdc++.h>
using namespace std;
queue<int> q;
int main() {
  ios::sync_with_stdio(0);
  int V, E, i, j, x, k, y, w = 0;
  cin >> V >> E;
  vector<int> P(100000);
  vector<int> p[2];
  vector<bool> C(100000);
  vector<vector<int> > G(V);
  for (i = 0; i < E; i++) {
    cin >> x >> y;
    G[y - 1].push_back(x - 1);
    G[x - 1].push_back(y - 1);
  }
  for (k = 0; k < V; k++) {
    if (C[k] == 0) {
      P[k] = 1;
      p[0].push_back(k);
      C[k] = 1;
      q.push(k);
      int a;
      while (!q.empty()) {
        a = q.front();
        q.pop();
        for (int i = 0; i < G[a].size(); i++) {
          if (P[a] == P[G[a][i]]) {
            w = 1;
            goto label;
          } else if (C[G[a][i]] == 0) {
            p[2 - P[a]].push_back(G[a][i]);
            C[G[a][i]] = 1;
            P[G[a][i]] = 3 - P[a];
            q.push(G[a][i]);
          }
        }
      }
    }
  }
  cout << p[0].size() << '\n';
  for (i = 0; i < p[0].size(); i++) {
    cout << p[0][i] + 1 << " ";
  }
  cout << '\n' << p[1].size() << '\n';
  for (i = 0; i < p[1].size(); i++) {
    cout << p[1][i] + 1 << " ";
  }
label:
  if (w == 1) cout << -1;
  return 0;
}
