#include <bits/stdc++.h>
using namespace std;
int maxn = 100001;
vector<int> adj[100001];
bool visited[100001];
int rec[100001];
vector<int> one, zero;
void dfs(int node, bool &detected, int prev, int cnt) {
  cnt++;
  visited[node] = true;
  rec[node] = cnt;
  if (cnt % 2 == 1) {
    zero.push_back(node);
  } else {
    one.push_back(node);
  }
  for (int next : adj[node]) {
    if (next != prev) {
      if (rec[next] == 0) {
        if (!visited[next]) dfs(next, detected, node, cnt);
      } else {
        if (abs(rec[node] - rec[next]) % 2 == 0) {
          detected = true;
        }
      }
    }
  }
  rec[node] = 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  bool detected = false;
  for (int i = 0; i < n; i++) {
    if (!visited[i + 1]) {
      dfs(i + 1, detected, -1, 0);
    }
    if (detected) {
      cout << "-1\n";
      return 0;
    }
  }
  cout << one.size() << "\n";
  for (int a : one) {
    cout << a << " ";
  }
  cout << "\n" << zero.size() << "\n";
  for (int a : zero) {
    cout << a << " ";
  }
  return 0;
}
