#include <bits/stdc++.h>
using namespace std;
int n, m, u, v;
bool vis[100007], vis2[100007], cycle;
vector<int> adj[100007], sol1, sol2;
int color[100007];
void DFS(int node, int par, bool white) {
  if (vis[node] && color[node] != white) {
    cycle = true;
    return;
  }
  if (vis[node]) return;
  vis[node] = true;
  color[node] = white;
  if (white) {
    sol1.push_back(node);
  } else
    sol2.push_back(node);
  for (int i = 0; i < adj[node].size(); i++) {
    if (adj[node][i] != par) DFS(adj[node][i], node, 1 - white);
  }
  return;
}
void mod_DFS(int node, int par) {
  if (vis2[node]) return;
  vis[node] = true;
  vis2[node] = true;
  for (int i = 0; i < adj[node].size(); i++) {
    if (adj[node][i] != par) mod_DFS(adj[node][i], node);
  }
  return;
}
int main() {
  cin >> n >> m;
  while (m--) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    cycle = false;
    if (!vis[i]) {
      DFS(i, -1, 1);
      if (cycle) {
        cout << -1;
        return 0;
      } else {
        mod_DFS(i, -1);
      }
    }
  }
  cout << sol1.size() << endl;
  for (int j = 0; j < sol1.size(); j++) {
    cout << sol1[j] << ' ';
  }
  cout << endl;
  cout << sol2.size() << endl;
  for (int j = 0; j < sol2.size(); j++) {
    cout << sol2[j] << ' ';
  }
  return 0;
}
