#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > v;
int dis[100010];
void bfs(int u) {
  dis[u] = 1;
  queue<int> q;
  q.push(u);
  while (!q.empty()) {
    int f = q.front();
    q.pop();
    for (int i = 0; i < v[f].size(); i++) {
      int d = v[f][i];
      if (!dis[d]) {
        dis[d] = dis[f] + 1;
        q.push(d);
      }
    }
  }
}
vector<int> res1, res2;
bool vis[100010];
bool test(int u) {
  queue<int> q;
  q.push(u);
  vis[u] = 1;
  while (!q.empty()) {
    int f = q.front();
    q.pop();
    if (dis[f] % 2 == 0)
      res2.push_back(f);
    else
      res1.push_back(f);
    for (int i = 0; i < v[f].size(); i++) {
      int d = v[f][i];
      if (dis[f] % 2 == dis[d] % 2) return false;
      if (!vis[d]) {
        q.push(d);
        vis[d] = 1;
      }
    }
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  v.resize(n + 10);
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    if (!dis[i]) bfs(i);
  }
  bool ok = 1;
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      ok = test(i);
      if (!ok) {
        break;
      }
    }
  }
  if (!ok) {
    cout << -1;
  } else {
    cout << res1.size() << endl;
    for (int i = 0; i < res1.size(); i++) cout << res1[i] << " ";
    cout << endl;
    cout << res2.size() << endl;
    for (int i = 0; i < res2.size(); i++) cout << res2[i] << " ";
  }
  return 0;
}
