#include <bits/stdc++.h>
using namespace std;
const int oo = 1e9 + 7;
const int maxn = 1e5 + 7;
int m, n, u, v, minn = oo, p[maxn];
vector<int> a[maxn], A, B;
bool flag = true;
void nhap() {
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) {
    cin >> u >> v;
    minn = min(min(minn, u), v);
    a[u].push_back(v);
    a[v].push_back(u);
  }
  for (int i = 1; i <= n; ++i) p[i] = -1;
}
void dfs(int u, int c) {
  if (!flag) return;
  if (p[u] != -1) {
    if (p[u] != c) {
      flag = false;
      return;
    } else
      return;
  }
  p[u] = c;
  if (c == 1)
    A.push_back(u);
  else
    B.push_back(u);
  if (a[u].size()) {
    for (int i = 0; i <= a[u].size() - 1; ++i) {
      if (c == 1)
        dfs(a[u][i], 2);
      else
        dfs(a[u][i], 1);
    }
  }
}
void solve() {
  for (int i = 1; i <= n; ++i)
    if (a[i].size() && p[i] == -1) dfs(i, 1);
  if (!flag) {
    cout << -1;
    return;
  }
  cout << A.size() << endl;
  for (int i = 0; i <= A.size() - 1; ++i) cout << A[i] << ' ';
  cout << endl;
  cout << B.size() << endl;
  for (int i = 0; i <= B.size() - 1; ++i) cout << B[i] << ' ';
}
void print() {}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  nhap();
  solve();
  print();
}
