#include <bits/stdc++.h>
using namespace std;
vector<vector<long long int> > edge(100010);
long long int vis[100010];
vector<long long int> color[2];
bool dfs(long long int a, long long int c = 2) {
  vis[a] = c;
  color[c - 1].push_back(a);
  for (auto x : edge[a]) {
    if (!vis[x] && dfs(x, 3ll - c)) {
      return 1;
    }
    if (vis[x] != 3ll - c) {
      return 1;
    }
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, m, x, y;
  cin >> n >> m;
  for (long long int i = 1; i <= m; i++) {
    cin >> x >> y;
    edge[x].push_back(y);
    edge[y].push_back(x);
  }
  for (long long int i = 1; i <= n; i++) {
    if (!vis[i]) {
      if (edge[i].size() == 0) {
        continue;
      }
      if (dfs(i)) {
        cout << -1 << endl;
        return 0;
      }
    }
  }
  for (long long int i = 0; i < 2; i++) {
    cout << color[i].size() << endl;
    for (auto x : color[i]) {
      cout << x << " ";
    }
    cout << endl;
  }
  return 0;
}
