#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> G[100010];
int color[100010] = {0};
bool dfs(int node, int col) {
  bool res = true;
  color[node] = col;
  for (int i = 0; res && i < G[node].size(); i++) {
    int to = G[node][i];
    if (color[to] == 0) {
      res = dfs(to, col == 1 ? 2 : 1);
    } else if (color[to] == col) {
      res = false;
    } else {
      continue;
    }
  }
  return res;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  bool good = true;
  for (int i = 0; i < n; i++) {
    if (color[i] == 0) {
      if (!dfs(i, 1)) {
        good = false;
        break;
      }
    }
  }
  if (!good) {
    cout << -1;
  } else {
    vector<int> res[3];
    for (int i = 0; i < n; i++) {
      res[color[i]].push_back(i);
    }
    for (int i = 1; i < 3; i++) {
      cout << res[i].size() << endl;
      for (int j = 0; j < res[i].size(); j++) {
        cout << (res[i][j] + 1) << " ";
      }
      cout << endl;
    }
  }
  return 0;
}
