#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int N = 100010;
int col[N];
vector<int> g[N];
bool bfs(int s, int n) {
  queue<int> p;
  p.push(s);
  col[s] = 1;
  while (!p.empty()) {
    int from = p.front();
    p.pop();
    for (int i = 0; i < g[from].size(); i++) {
      if (col[g[from][i]] == -1) {
        p.push(g[from][i]);
        col[g[from][i]] = !col[from];
      }
      if (col[from] == col[g[from][i]]) return false;
    }
  }
  return true;
}
int main() {
  int n, m, a, b, i;
  memset(col, -1, sizeof(col));
  cin >> n >> m;
  for (i = 0; i < m; i++) {
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  bool flag = false;
  for (i = 1; i <= n; i++)
    if (col[i] == -1 && !bfs(i, n)) {
      flag = true;
      break;
    }
  if (flag)
    cout << "-1" << endl;
  else {
    vector<int> v[5];
    for (i = 1; i <= n; i++) {
      if (col[i] == -1)
        continue;
      else
        v[col[i]].push_back(i);
    }
    cout << v[0].size() << endl;
    for (i = 0; i < v[0].size(); i++) cout << v[0][i] << ' ';
    cout << endl;
    cout << v[1].size() << endl;
    for (i = 0; i < v[1].size(); i++) cout << v[1][i] << ' ';
    cout << endl;
  }
}
