#include <bits/stdc++.h>
using namespace std;
int n, m, a, x, y, b, f;
vector<int> A[100001];
int Ax[100001], Ay[100001];
int B[100001];
void fnc(int i, int z) {
  if (B[i] != 0) return;
  if (z % 2 == 0) {
    B[i] = 1;
    a++;
    Ax[a] = i;
  } else {
    B[i] = 2;
    b++;
    Ay[b] = i;
  }
  for (int jj = 0; jj < A[i].size(); ++jj) {
    int d = z + 1;
    if (B[i] == B[A[i][jj]]) {
      f = 1;
      return;
    }
    fnc(A[i][jj], d);
  }
  return;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) {
    cin >> x >> y;
    A[x].push_back(y);
    A[y].push_back(x);
  }
  for (int i = 1; i <= n; ++i) {
    if ((B[i] == 0) && (A[i].size() > 0)) {
      fnc(i, 0);
    }
  }
  if ((a + b == 0) || (f == 1)) {
    cout << -1;
    return 0;
  }
  cout << b << endl;
  for (int i = 1; i <= b; ++i) {
    cout << Ay[i] << " ";
  }
  cout << endl;
  cout << a << endl;
  for (int i = 1; i <= a; ++i) {
    cout << Ax[i] << " ";
  }
  return 0;
}
