#include <bits/stdc++.h>
using namespace std;
vector<int> v[100005];
int vis[100005];
bool wr = 0;
void dfs2(int);
void dfs1(int x) {
  vis[x] = 1;
  for (int i = 0; i < v[x].size(); ++i) {
    if (vis[v[x][i]] == 1) {
      wr = 1;
    }
    if (!vis[v[x][i]]) dfs2(v[x][i]);
  }
}
void dfs2(int x) {
  vis[x] = 2;
  for (int i = 0; i < v[x].size(); ++i) {
    if (vis[v[x][i]] == 2) {
      wr = 1;
    }
    if (!vis[v[x][i]]) dfs1(v[x][i]);
  }
}
int main() {
  int n, m;
  while (cin >> n >> m) {
    set<int> s;
    memset(vis, 0, sizeof vis);
    for (int i = 0; i < m; ++i) {
      int fr, to;
      scanf("%d %d", &fr, &to);
      v[fr].push_back(to);
      v[to].push_back(fr);
      s.insert(fr);
      s.insert(to);
    }
    vector<int> nodes;
    for (set<int>::iterator it = s.begin(); it != s.end(); ++it) {
      int now = *it;
      nodes.push_back(now);
    }
    bool tu = 0;
    for (int i = 0; i < nodes.size(); ++i) {
      if (!vis[nodes[i]]) {
        if (tu)
          tu = 0, dfs1(nodes[i]);
        else
          tu = 1, dfs2(nodes[i]);
      }
    }
    if (wr) {
      cout << -1 << endl;
      continue;
    }
    vector<int> fi, se;
    for (int i = 0; i < nodes.size(); ++i) {
      if (vis[nodes[i]] == 1) {
        fi.push_back(nodes[i]);
      } else if (vis[nodes[i]] == 2)
        se.push_back(nodes[i]);
    }
    if (fi.size() == 0 || se.size() == 0) {
      cout << -1 << endl;
      continue;
    }
    cout << fi.size() << endl;
    for (int i = 0; i < fi.size(); ++i) printf("%d ", fi[i]);
    cout << endl;
    cout << se.size() << endl;
    for (int i = 0; i < se.size(); ++i) printf("%d ", se[i]);
    cout << endl;
  }
}
