#include <bits/stdc++.h>
using namespace std;
int n, m, max;
vector<int> a[100000];
bool visited[100000] = {0};
char col[100000] = {'Z'};
void f(int x) {
  queue<int> q;
  q.push(x);
  visited[x] = 1;
  char temp = 'A';
  col[x] = temp;
  while (!q.empty()) {
    int p = q.front();
    q.pop();
    temp = col[p];
    if (temp == 'A')
      temp = 'B';
    else
      temp = 'A';
    for (int i = 0; i < a[p].size(); i++) {
      if (visited[a[p][i]] == false) {
        q.push(a[p][i]);
        visited[a[p][i]] = true;
        col[a[p][i]] = temp;
      } else if (col[a[p][i]] != temp) {
        puts("-1");
        exit(0);
      }
    }
  }
}
int main() {
  cin >> n >> m;
  int x, y;
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    x--;
    y--;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  f(x);
  for (int i = 0; i < 100000; i++) {
    if (a[i].size() && visited[i] == 0) f(i);
  }
  int c1 = 0;
  for (int i = 0; i < 100000; i++)
    if (col[i] == 'B') c1++;
  cout << c1 << "\n";
  for (int i = 0; i < 100000; i++)
    if (col[i] == 'B') cout << i + 1 << " ";
  cout << "\n";
  c1 = 0;
  for (int i = 0; i < 100000; i++)
    if (col[i] == 'A') c1++;
  cout << c1 << "\n";
  for (int i = 0; i < 100000; i++)
    if (col[i] == 'A') cout << i + 1 << " ";
  cout << "\n";
  return 0;
}
