#include <bits/stdc++.h>
const long long MaxN = 1e5 + 50;
using namespace std;
int n, m, u, v;
bool cycle = 0;
char pos[MaxN];
vector<int> g[MaxN], A, P;
char opsT(char in) { return in == 'A' ? 'P' : 'A'; }
void dfs(int cur, int adj) {
  if (cycle) return;
  if (cur == adj)
    pos[cur] = 'A';
  else
    pos[cur] = opsT(pos[adj]);
  for (int i = 0; i < g[cur].size(); i++) {
    int I = g[cur][i];
    if (pos[I] == ' ') dfs(I, cur);
    if (pos[I] == pos[cur] && I != adj) {
      cycle = true;
      return;
    }
  }
}
int main() {
  fill(pos, pos + MaxN, ' ');
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> u >> v, u--, v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 0; i < n; i++)
    if (!cycle && pos[i] == ' ') dfs(i, i);
  if (cycle) return cout << -1, 0;
  for (int i = 0; i < n; i++) {
    if (pos[i] == 'A')
      A.push_back(i);
    else if (pos[i] == 'P')
      P.push_back(i);
  }
  cout << A.size() << endl;
  for (auto x : A) cout << x + 1 << ' ';
  cout << '\n' << P.size() << '\n';
  for (auto y : P) cout << y + 1 << ' ';
}
