#include <bits/stdc++.h>
using namespace std;
vector<long long> G[100001];
int chk[100001];
bool bfs(long long start) {
  queue<long long> q;
  q.push(start);
  chk[start] = 0;
  while (!q.empty()) {
    long long top = q.front();
    q.pop();
    for (int i = 0; i < G[top].size(); i++) {
      if (chk[G[top][i]] == -1) {
        q.push(G[top][i]);
        chk[G[top][i]] = chk[top] == 1 ? 0 : 1;
      } else if (chk[G[top][i]] == chk[top]) {
        return false;
      }
    }
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  long long n, m;
  long long u, v;
  cin >> n >> m;
  memset(chk, -1, sizeof(chk));
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  bool result = true;
  for (int i = 1; i <= n; i++) {
    if (chk[i] == -1) {
      result = bfs(i) & result;
    }
  }
  if (result) {
    long long ctr1 = 0, ctr0 = 0;
    for (int i = 1; i <= n; i++) {
      if (chk[i] == 1)
        ctr1++;
      else if (chk[i] == 0)
        ctr0++;
    }
    cout << ctr0 << endl;
    for (int i = 1; i <= n; i++)
      if (chk[i] == 0) cout << i << ' ';
    cout << endl;
    cout << ctr1 << endl;
    for (int i = 1; i <= n; i++)
      if (chk[i] == 1) cout << i << ' ';
    cout << endl;
  } else
    cout << "-1\n";
}
