#include <bits/stdc++.h>
using namespace std;
int E = 0, mark[100005];
bool op;
vector<int> v[100005];
void dfs(int a) {
  if (mark[a] == 0) mark[a] = 1;
  for (int i = 0; i < v[a].size(); i++) {
    int k = v[a][i];
    if (mark[k] == mark[a]) {
      cout << "-1";
      exit(0);
    } else if (mark[k] == 0) {
      mark[k] = 3 - mark[a];
      dfs(k);
    }
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; 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 (mark[i] == 0) {
      dfs(i);
    }
  }
  int EE = 0;
  for (int i = 1; i <= n; i++) {
    if (mark[i] != 2)
      E++;
    else
      EE++;
  }
  cout << EE << endl;
  for (int i = 1; i <= n; i++) {
    if (mark[i] == 2) cout << i << " ";
  }
  cout << endl;
  cout << E << endl;
  for (int i = 1; i <= n; i++) {
    if (mark[i] != 2) cout << i << " ";
  }
  return 0;
}
