#include <bits/stdc++.h>
using namespace std;
vector<int> first, second, g[100001];
int used[100001];
int n, m;
void DFS(int v) {
  if (used[v] == 1)
    first.push_back(v);
  else
    second.push_back(v);
  for (int i = 0; i < g[v].size(); i++) {
    int x = g[v][i];
    if (used[x] == 0) {
      if (used[v] == 1)
        used[x] = 2;
      else
        used[x] = 1;
      DFS(x);
    } else if (used[x] == used[v]) {
      cout << -1;
      exit(0);
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    if (used[i] == 0) {
      used[i] = 1;
      DFS(i);
    }
  }
  cout << first.size() << endl;
  for (int i = 0; i < first.size(); i++) cout << first[i] << " ";
  cout << endl;
  cout << second.size() << endl;
  for (int t = 0; t < second.size(); t++) cout << second[t] << " ";
}
