#include <bits/stdc++.h>
using namespace std;
vector<int> G[100005];
int color[100005];
bool dfs(int u) {
  int num = G[u].size();
  for (int i = 0; i < num; i++) {
    int v = G[u][i];
    if (color[v] == -1) {
      color[v] = 1 - color[u];
      if (!dfs(v)) return false;
    } else if (color[u] == color[v])
      return false;
  }
  return true;
}
int main() {
  int n, m, i;
  int a, b;
  scanf("%d%d", &n, &m);
  for (i = 0; i <= n; i++) color[i] = -1;
  for (i = 0; i < m; i++) {
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  for (i = 1; i <= n; i++) {
    if (color[i] == -1) {
      if (G[i].size() != 0) {
        color[i] = 0;
        if (!dfs(i)) {
          cout << "-1" << endl;
          return 0;
        }
      }
    }
  }
  int n1 = 0, n2 = 0;
  for (i = 1; i <= n; i++) {
    if (color[i] == 1) n1++;
    if (color[i] == 0) n2++;
  }
  cout << n1 << endl;
  for (i = 1; i <= n; i++) {
    if (color[i] == 1) cout << i << " ";
  }
  cout << endl << n2 << endl;
  for (i = 1; i <= n; i++) {
    if (color[i] == 0) cout << i << " ";
  }
  return 0;
}
