#include <bits/stdc++.h>
using namespace std;
const double PI = 3.141592653589793;
template <template <typename> class Array, typename T>
void outArray(Array<T>& a) {
  auto it = a.begin();
  for (; it != a.end(); it++) {
    cout << (*it) << " ";
  }
  cout << "\n";
}
template <typename T>
void outVector(vector<T>& a) {
  for (int i = 0; i < a.size(); i++) {
    cout << a[i] + 1 << " ";
  }
  cout << "\n";
}
void dfs(int v, int depth, vector<vector<int>>& a, vector<int>& color,
         bool& ok) {
  color[v] = depth % 2;
  for (int i = 0; i < a[v].size(); i++) {
    if (color[a[v][i]] == -1) {
      dfs(a[v][i], depth + 1, a, color, ok);
    } else if (color[a[v][i]] == color[v]) {
      ok = false;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  vector<vector<int>> a(n);
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  vector<int> color(n, -1);
  bool ok = true;
  for (int i = 0; i < n; i++) {
    if (color[i] == -1) {
      dfs(i, 0, a, color, ok);
    }
  }
  vector<int> ans1, ans2;
  for (int i = 0; i < n; i++) {
    if (color[i]) {
      ans1.push_back(i);
    } else {
      ans2.push_back(i);
    }
  }
  if (ok) {
    cout << ans1.size() << "\n";
    outVector(ans1);
    cout << ans2.size() << "\n";
    outVector(ans2);
  } else {
    cout << "-1\n";
  }
  return 0;
}
