#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> g[100100];
bool cycle;
int colour[100100];
int even[100100];
int parent[100100];
void dfs(int p) {
  colour[p] = 1;
  for (int i = 0; i < g[p].size(); i++) {
    int to = g[p][i];
    if (parent[p] == to) continue;
    if (colour[to] == 0) {
      parent[to] = p;
      even[to] = (even[p] + 1) % 2;
      dfs(to);
    } else if (colour[to] == 1) {
      if (even[to] == even[p]) {
        cycle = true;
      }
    }
  }
}
int main() {
  memset(even, -1, sizeof(even));
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    if (colour[i] == 0) {
      even[i] = 0;
      dfs(i);
    }
  }
  if (cycle) {
    cout << "-1" << endl;
  } else {
    int counter = 0;
    for (int i = 1; i <= n; i++) {
      if (even[i]) counter++;
    }
    cout << counter << endl;
    bool first = true;
    for (int i = 1; i <= n; i++) {
      if (even[i]) {
        if (first) {
          cout << i;
        } else {
          cout << " " << i;
        }
        first = false;
      }
    }
    cout << endl;
    cout << n - counter << endl;
    first = true;
    for (int i = 1; i <= n; i++) {
      if (!even[i]) {
        if (first) {
          cout << i;
        } else {
          cout << " " << i;
        }
        first = false;
      }
    }
    cout << endl;
  }
  return 0;
}
