#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 * 1000;
vector<int> f, s;
vector<int> adj[MAXN + 10];
bool vis[MAXN + 10], bip[MAXN + 10];
bool dcd = true;
void dfs(int v, int len) {
  vis[v] = 1;
  if (len % 2 == 0) bip[v] = 1;
  for (int u : adj[v]) {
    if (!vis[u])
      dfs(u, len + 1);
    else {
      if (bip[v] == bip[u]) {
        dcd = 0;
      }
    }
  }
}
int main() {
  int n, m, a, b;
  cin >> n >> m;
  for (int i = 0; i < m; i++)
    cin >> a >> b, adj[a].push_back(b), adj[b].push_back(a);
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) dfs(i, 0);
  }
  if (!dcd)
    cout << -1 << endl;
  else {
    for (int i = 1; i <= n; i++) {
      if (bip[i])
        f.push_back(i);
      else
        s.push_back(i);
    }
    cout << f.size() << endl;
    for (int i : f) cout << i << " ";
    cout << endl;
    cout << s.size() << endl;
    for (int i : s) cout << i << " ";
  }
}
