#include <bits/stdc++.h>
using namespace std;
vector<int> a[100005];
bool visited[100005];
int color[100005];
bool dfs(int second, int c) {
  visited[second] = true;
  color[second] = c;
  for (auto x : a[second]) {
    if (visited[x] == false) {
      if (dfs(x, (-1 * c)) == false) return false;
    } else {
      if (color[x] == (c)) return false;
    }
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    if (visited[i] == false && (a[i].size() > 0)) {
      if (dfs(i, 1) == false) return cout << -1, 0;
    }
  }
  int aa = 0, bb = 0;
  for (int i = 1; i < n + 1; i++) {
    if (color[i] == 1)
      aa++;
    else if (color[i] == -1)
      bb++;
  }
  cout << aa << endl;
  for (int i = 1; i < n + 1; i++)
    if (color[i] == 1) cout << i << " ";
  cout << endl;
  cout << bb << endl;
  for (int i = 1; i < n + 1; i++)
    if (color[i] == -1) cout << i << " ";
}
