#include <bits/stdc++.h>
using namespace std;
vector<int> adj[100005];
int color[100005];
int main() {
  ios_base::sync_with_stdio(0);
  int i, j, n, m;
  cin >> n >> m;
  while (m--) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  bool f = true;
  memset(color, -1, sizeof(color));
  for (int p = 1; p <= n; p++) {
    if (color[p] != -1) continue;
    if (adj[p].size() == 0) continue;
    queue<int> q;
    q.push(p);
    color[p] = 0;
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      for (int j = 0; j < adj[u].size(); j++) {
        int v = adj[u][j];
        if (color[v] == -1) {
          color[v] = 1 - color[u];
          q.push(v);
        } else if (color[v] == color[u]) {
          f = false;
          break;
        }
      }
    }
  }
  if (f == 0) {
    cout << "-1" << '\n';
    return 0;
  }
  int k = 0;
  for (i = 1; i <= n; i++)
    if (color[i] == 0) k++;
  cout << k << '\n';
  for (i = 1; i <= n; i++)
    if (color[i] == 0) cout << i << ' ';
  cout << '\n';
  k = 0;
  for (i = 1; i <= n; i++)
    if (color[i] == 1) k++;
  cout << k << '\n';
  for (i = 1; i <= n; i++)
    if (color[i] == 1) cout << i << ' ';
  cout << '\n';
  return 0;
}
