#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 100;
vector<int> G[maxn];
int n, m;
int color[maxn];
bool dfs(int u, int c) {
  color[u] = c;
  for (int v = 0; v < G[u].size(); v++) {
    if (color[G[u][v]] == c) return false;
    if (color[G[u][v]] == 0 && !dfs(G[u][v], -c)) return false;
  }
  return true;
}
bool judge() {
  for (int i = 1; i <= n; i++) {
    if (color[i] == 0) {
      if (!dfs(i, 1)) return false;
    }
  }
  return true;
}
void solve() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  memset(color, 0, sizeof(color));
  cin >> n >> m;
  for (int k = 1; k <= m; k++) {
    int a, b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  if (!judge())
    cout << "-1" << endl;
  else {
    int num = 0;
    for (int i = 1; i <= n; i++) {
      if (color[i] == 1) ++num;
    }
    cout << num << endl;
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
      if (color[i] == 1) {
        ++cnt;
        cout << i << (cnt == num ? '\n' : ' ');
      }
    }
    cout << (n - num) << endl;
    cnt = 0;
    for (int i = 1; i <= n; i++) {
      if (color[i] == -1) {
        ++cnt;
        cout << i << (cnt == n - num ? '\n' : ' ');
      }
    }
  }
}
int main() {
  solve();
  return 0;
}
