#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
vector<int> v[maxn];
int b[maxn];
bool dfs(int node, int c) {
  b[node] = c;
  int size = v[node].size();
  for (int i = 0; i < size; ++i) {
    int u = v[node][i];
    if (b[u] == -1) {
      if (dfs(u, c ^ 1) == 0) {
        return false;
      }
    } else if (b[u] == c) {
      return false;
    }
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  memset(b, -1, sizeof(b));
  int flag = 1;
  for (int i = 1; i <= n; ++i) {
    if (b[i] == -1) {
      if (dfs(i, 0) == 0) {
        flag = 0;
        break;
      }
    }
  }
  if (flag) {
    int sum = 0;
    for (int i = 1; i <= n; ++i) {
      sum += b[i];
    }
    cout << sum << endl;
    for (int i = 1; i <= n; ++i) {
      if (b[i]) {
        cout << i << " ";
      }
    }
    cout << endl;
    cout << n - sum << endl;
    for (int i = 1; i <= n; ++i) {
      if (b[i] == 0) {
        cout << i << " ";
      }
    }
    cout << endl;
  } else {
    cout << "-1\n";
  }
  return 0;
}
