#include <bits/stdc++.h>
using namespace std;
vector<int> v1, v2, adj[100100];
int col[100100], n, m;
bool f, mark[100100];
void dfs(int x) {
  mark[x] = true;
  for (int i = 0; i < adj[x].size(); i++) {
    int v = adj[x][i];
    if (!mark[v]) {
      col[v] = 1 - col[x];
      if (col[v]) v2.push_back(v);
      if (!col[v]) v1.push_back(v);
      dfs(v);
    } else if (col[v] == col[x])
      f = false;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  f = true;
  for (int i = 1; i <= n; i++)
    if (!mark[i] && adj[i].size()) v1.push_back(i), dfs(i);
  if (!f)
    cout << -1;
  else {
    cout << v1.size() << endl;
    sort(v1.begin(), v1.end());
    for (int i = 0; i < v1.size(); i++) cout << v1[i] << " ";
    cout << endl << v2.size() << endl;
    sort(v2.begin(), v2.end());
    for (int i = 0; i < v2.size(); i++) cout << v2[i] << " ";
  }
  return 0;
}
