#include <bits/stdc++.h>
using namespace std;
vector<int> myvec[100001];
set<int> myset[2];
set<int>::iterator it;
int mark[100001];
bool isbipartite(int src) {
  int color[100001];
  memset(color, -1, sizeof(color));
  queue<int> q;
  q.push(src);
  mark[src] = 1;
  color[src] = 1;
  myset[color[src]].insert(src);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int v = 0; v < myvec[u].size(); v++) {
      if (color[myvec[u][v]] == -1)
        color[myvec[u][v]] = 1 - color[u], q.push(myvec[u][v]),
        myset[color[myvec[u][v]]].insert(myvec[u][v]), mark[myvec[u][v]] = 1;
      else if (color[myvec[u][v]] == color[u])
        return false;
    }
  }
  return true;
}
int main() {
  long long int x, y;
  int a, b;
  cin >> a >> b;
  while (b--) {
    cin >> x >> y;
    myvec[x].push_back(y);
    myvec[y].push_back(x);
  }
  bool solve = true;
  for (int i = 1; i <= a; i++) {
    if (mark[i] == 0) {
      solve = (solve && isbipartite(i));
    }
  }
  if (solve == true) {
    cout << myset[0].size() << endl;
    for (it = myset[0].begin(); it != myset[0].end(); it++) {
      cout << *it << " ";
    }
    cout << endl;
    cout << myset[1].size() << endl;
    for (it = myset[1].begin(); it != myset[1].end(); it++) {
      cout << *it << " ";
    }
    cout << endl;
  } else
    cout << "-1" << endl;
  return 0;
}
