#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  return b == 0 ? abs(a) : gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int prime[1000000];
void seive() {
  int n_prime = 1000000;
  fill_n(prime, n_prime, 1);
  prime[0] = 0;
  prime[1] = 0;
  for (int i = 2; i * i <= n_prime; i++) {
    if (prime[i]) {
      for (int j = i * i; j <= n_prime; j += i) {
        prime[j] = 0;
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  int x, y;
  std::cin >> n >> m;
  vector<int> adj[n];
  vector<int> vis(n, 0);
  vector<int> col(n, 0);
  vector<int> ans1, ans2;
  int temp = 0;
  for (int i = 0; i < m; i++) {
    std::cin >> x >> y;
    adj[x - 1].push_back(y - 1);
    adj[y - 1].push_back(x - 1);
  }
  for (int i = 0; i < n; i++) {
    if (vis[i] == 0) {
      queue<int> q;
      vis[i] = 1;
      q.push(i);
      while (!q.empty()) {
        int s = q.front();
        q.pop();
        for (auto u : adj[s]) {
          if (vis[u] == 0) {
            vis[u] = 1;
            col[u] = col[s] ^ 1;
            q.push(u);
          } else {
            if (col[u] == col[s]) {
              temp = 1;
            }
          }
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (col[i]) {
      ans1.push_back(i + 1);
    } else {
      ans2.push_back(i + 1);
    }
  }
  if (temp == 1) {
    std::cout << -1 << '\n';
  } else {
    std::cout << (int)ans1.size() << '\n';
    for (auto i : ans1) cout << i << " ";
    std::cout << '\n';
    std::cout << (int)ans2.size() << '\n';
    for (auto i : ans2) cout << i << " ";
    std::cout << '\n';
  }
  return 0;
}
