#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<bool> vis(n);
  vector<bool> azul(n);
  int blu = 0;
  vector<vector<int> > adj(n);
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  for (int i = 0; i < n; i++) {
    if (!vis[i]) {
      stack<pair<int, bool> > fs;
      fs.push(make_pair(i, 1));
      int x;
      bool color;
      while (!fs.empty()) {
        pair<int, bool> wtf = fs.top();
        fs.pop();
        x = wtf.first;
        color = wtf.second;
        if (!vis[x]) {
          vis[x] = 1;
          if (color) {
            blu++;
            azul[x] = 1;
          }
          for (int j = 0; j < adj[x].size(); j++) {
            if (vis[adj[x][j]]) {
              if (color == azul[adj[x][j]]) {
                cout << -1 << endl;
                return 0;
              }
            } else {
              fs.push(make_pair(adj[x][j], color ^ 1));
            }
          }
        }
      }
    }
  }
  cout << blu << endl;
  for (int i = 0; i < n; i++) {
    if (azul[i]) {
      cout << i + 1 << " ";
    }
  }
  cout << endl;
  cout << n - blu << endl;
  for (int i = 0; i < n; i++) {
    if (!azul[i]) {
      cout << i + 1 << " ";
    }
  }
  cout << endl;
  return 0;
}
