#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
vector<int> vec[maxn];
vector<int> col(maxn, -1);
vector<bool> vis(maxn);
int ans;
void dfs(int nod, int c) {
  if (vec[nod].size() == 0) return;
  col[nod] = c;
  vis[nod] = true;
  for (auto i : vec[nod]) {
    if (!vis[i])
      dfs(i, 1 - c);
    else if (col[i] == c)
      ans = 1;
  }
}
int main() {
  int n, m, k, i;
  cin >> n >> m;
  while (m--) {
    int a, b;
    cin >> a >> b;
    vec[a].push_back(b);
    vec[b].push_back(a);
  }
  for (i = 1; i <= n; i++) {
    if (!vis[i]) dfs(i, 0);
  }
  if (ans) {
    cout << -1;
    return 0;
  }
  vector<int> v1, v2;
  for (int i = 1; i <= n; i++)
    if (col[i] == 1)
      v1.push_back(i);
    else if (col[i] == 0)
      v2.push_back(i);
  cout << v1.size() << "\n";
  for (auto i : v1) cout << i << " ";
  cout << "\n";
  cout << v2.size() << "\n";
  for (auto i : v2) cout << i << " ";
  cout << "\n";
}
