#include <bits/stdc++.h>
using namespace std;
bool visited[100000];
bool player[100000];
vector<vector<int> > graph;
bool valid = true;
int vcount = 0;
void visit(int pos) {
  if (player[pos]) vcount++;
  for (auto s : graph[pos]) {
    if (valid && visited[s])
      valid = player[s] != player[pos];
    else if (valid) {
      visited[s] = true;
      player[s] = !player[pos];
      visit(s);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cout << setprecision(12) << fixed;
  int N, M;
  cin >> N >> M;
  graph.resize(N);
  for (int i = (0); i < (M); ++i) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  fill_n(visited, N, false);
  for (int pos = (0); pos < (N); ++pos) {
    if (!visited[pos]) {
      visited[pos] = true;
      player[pos] = true;
      visit(pos);
    }
  }
  if (valid) {
    cout << vcount << endl;
    bool space = false;
    for (int i = (0); i < (N); ++i)
      if (player[i]) {
        if (space) {
          cout << " ";
        } else {
          space = true;
        }
        cout << i + 1;
      }
    cout << endl;
    cout << N - vcount << endl;
    space = false;
    for (int i = (0); i < (N); ++i)
      if (!player[i]) {
        if (space) {
          cout << " ";
        } else {
          space = true;
        }
        cout << i + 1;
      }
    cout << endl;
  } else {
    cout << "-1" << endl;
  }
  return 0;
}
