#include <bits/stdc++.h>
using namespace std;
int ans;
const int MAXN = 100005;
vector<int> Map[MAXN], ansM[5];
int d[MAXN];
int n, m;
void dfs(int u) {
  for (auto v : Map[u]) {
    if (d[v] == -1) {
      d[v] = d[u] ^ 1;
      dfs(v);
    } else if (d[v] != d[u] ^ 1) {
      ans = -1;
      return;
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    Map[x].push_back(y);
    Map[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) d[i] = -1;
  for (int i = 1; i <= n; i++)
    if (Map[i].size() > 0 && d[i] == -1) {
      d[i] = 0;
      dfs(i);
      if (ans < 0) {
        cout << -1 << endl;
        return 0;
      }
    }
  for (int i = 1; i <= n; i++) {
    if (d[i] == 0)
      ansM[0].push_back(i);
    else if (d[i] == 1)
      ansM[1].push_back(i);
  }
  cout << ansM[0].size() << endl;
  cout << ansM[0][0];
  for (int i = 1; i < ansM[0].size(); i++) cout << ' ' << ansM[0][i];
  cout << endl;
  cout << ansM[1].size() << endl;
  cout << ansM[1][0];
  for (int i = 1; i < ansM[1].size(); i++) cout << ' ' << ansM[1][i];
  cout << endl;
}
