#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int mark[maxn], a[maxn];
vector<int> yal[maxn], ans[3];
int dfs(int now, int t) {
  mark[now] = 1;
  ans[t].push_back(now);
  a[now] = t;
  for (int i = 0; i < yal[now].size(); i++) {
    if (!mark[yal[now][i]]) {
      int s;
      if (t == 1)
        s = dfs(yal[now][i], 2);
      else
        s = dfs(yal[now][i], 1);
      if (s == -1) return -1;
    } else {
      if (a[yal[now][i]] == t) return -1;
    }
  }
  return 0;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    yal[u].push_back(v);
    yal[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (!mark[i] and yal[i].size()) {
      int ans = dfs(i, 1);
      if (ans == -1) {
        cout << -1 << endl;
        return 0;
      }
    }
  }
  int s = ans[1].size();
  cout << s << endl;
  for (int i = 0; i < s; i++) cout << ans[1][i] << ' ';
  cout << endl;
  s = ans[2].size();
  cout << s << endl;
  for (int i = 0; i < s; i++) cout << ans[2][i] << ' ';
  cout << endl;
  return 0;
}
