//vertex cover using bi partite
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define si(i) scanf("%d",&i)
#define fs first
#define sc second
#define pii pair<int,int>
#define psi pair<string,int>
#define FOR(i,j,k) for(int i=j;i<k;i++)
#define REP(i,k) for(int i=0;i<k;i++)
#define FORR(i,j,k) for(int i=n;i>=k;i--)
#define test(t) int t;si(t);while(t--)
#define MOD 1000000007
using namespace std;
std::vector<int> v[100005];
int color[100005];
int bfs(int a){
queue<int> q;
q.push(a);
color[a] = 0;
while(!q.empty()){
int f = q.front();
q.pop();
int l = v[f].size();
REP(i,l){
int p = v[f][i];
if(color[p] == -1){
color[p] = (color[f] == 1) ? 0 : 1;
q.push(p);
}
else{
if(color[p] == color[f])
return 1;
}
}
}
return 0;
}
int main()
{
//std::iostream::sync_with_stdio(false);
int n,m;
si(n);
si(m);
int a,b;
memset(color,-1,sizeof(color));
REP(i,m){
si(a);
si(b);
v[a].pb(b);
v[b].pb(a);
}
int flag = bfs(1);
if(flag){
printf("-1\n");
return 0;
}
std::vector<int> v1,v2;
FOR(i,1,n+1)
if(color[i] == 0)
v1.pb(i);
else
v2.pb(i);
int l1 = v1.size();
int l2 = v2.size();
cout << l2 << endl;
REP(i,l2)
cout << v2[i] << " ";
cout << endl;
cout << l1 << endl;
REP(i,l1)
cout << v1[i] << " ";
cout << endl;
return 0;
}
Ly92ZXJ0ZXggY292ZXIgdXNpbmcgYmkgcGFydGl0ZQojaW5jbHVkZTxiaXRzL3N0ZGMrKy5oPgojZGVmaW5lIGxsIGxvbmcgbG9uZyAKI2RlZmluZSBwYiBwdXNoX2JhY2sKI2RlZmluZSBtcCBtYWtlX3BhaXIKI2RlZmluZSBzaShpKSBzY2FuZigiJWQiLCZpKQojZGVmaW5lIGZzIGZpcnN0CiNkZWZpbmUgc2Mgc2Vjb25kCiNkZWZpbmUgcGlpIHBhaXI8aW50LGludD4KI2RlZmluZSBwc2kgcGFpcjxzdHJpbmcsaW50PgojZGVmaW5lIEZ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