#include <bits/stdc++.h>
int mark[300010];
using namespace std;
vector<int> co[2];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> v[n + 1];
  for (int i = 0; i < m; i++) {
    int u, v1;
    cin >> u >> v1;
    v[u].push_back(v1);
    v[v1].push_back(u);
  }
  int color[n + 1];
  for (int i = 1; i <= n; i++) {
    color[i] = -1;
  }
  bool flag = true;
  for (int i = 1; i <= n; i++) {
    if (color[i] == -1) {
      color[i] = 1;
      queue<int> q;
      q.push(i);
      while (!q.empty() && flag) {
        int u = q.front();
        q.pop();
        for (int i = 0; i < v[u].size(); i++) {
          int j = v[u][i];
          if (color[j] == -1) {
            color[j] = 1 - color[u];
            q.push(j);
          } else if (color[u] == color[j]) {
            flag = false;
            break;
          }
        }
      }
    }
  }
  if (flag == true) {
    for (int i = 1; i <= n; i++) {
      co[color[i]].push_back(i);
    }
    for (int i = 0; i < 2; i++) {
      cout << co[i].size() << endl;
      for (int j = 0; j < co[i].size(); j++) {
        cout << co[i][j] << " ";
      }
      cout << endl;
    }
  } else {
    cout << -1 << endl;
  }
  return 0;
}
