#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> c;
vector<int> a;
vector<int> a1;
vector<int> a2;
vector<int> used;
bool exitt = false;
void DFS(int k, int t) {
  if (t == 1) {
    a1.push_back(k);
    used[k] = 1;
    a[k] = 1;
  } else {
    a2.push_back(k);
    used[k] = 1;
    a[k] = 2;
  }
  for (int i = 0; i < c[k].size(); i++) {
    if (a[c[k][i]] == t) {
      exitt = true;
      return;
    } else {
      if (used[c[k][i]] == 0) {
        if (t == 1) {
          DFS(c[k][i], 2);
        } else {
          DFS(c[k][i], 1);
        }
      }
    }
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  a.resize(n);
  c.resize(n);
  used.resize(n);
  for (int i = 0; i < m; i++) {
    int a1, a2;
    cin >> a1 >> a2;
    a1--;
    a2--;
    c[a1].push_back(a2);
    c[a2].push_back(a1);
  }
  for (int i = 0; i < n; i++) {
    if (used[i] == 0) {
      DFS(i, 1);
    }
  }
  if (exitt) {
    cout << "-1";
  } else {
    cout << a1.size() << endl;
    for (int i = 0; i < a1.size(); i++) {
      cout << a1[i] + 1 << " ";
    }
    cout << endl;
    cout << a2.size() << endl;
    for (int i = 0; i < a2.size(); i++) {
      cout << a2[i] + 1 << " ";
    }
    cout << endl;
  }
  return 0;
}
