#include <bits/stdc++.h>
using namespace std;
const int maxN = 100000 + 10;
int col[maxN];
vector<int> v[maxN];
bool flag;
void dfs(int x, int color) {
  col[x] = color;
  for (int i = 0; i < v[x].size(); i++) {
    if (col[v[x][i]] == col[x]) flag = true;
    if (!col[v[x][i]]) dfs(v[x][i], 3 - col[x]);
  }
  return;
}
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 (!col[i]) dfs(i, 1);
  }
  if (flag) {
    cout << -1 << endl;
    return 0;
  }
  vector<int> ans1, ans2;
  for (int i = 1; i <= n; i++) {
    if (col[i] == 1)
      ans1.push_back(i);
    else
      ans2.push_back(i);
  }
  cout << ans1.size() << endl;
  for (int i = 0; i < ans1.size(); i++) cout << ans1[i] << " ";
  cout << endl;
  cout << ans2.size() << endl;
  for (int i = 0; i < ans2.size(); i++) cout << ans2[i] << " ";
  return 0;
}
