Recently, Pari and Arya did some research about NP-Hard problems and they found the minimum vertex cover problem very interesting.

Suppose the graph G is given. Subset A of its vertices is called a vertex cover of this graph, if for each edge uv there is at least one endpoint of it in this set, i.e. <image> or <image> (or both).

Pari and Arya have won a great undirected graph as an award in a team contest. Now they have to split it in two parts, but both of them want their parts of the graph to be a vertex cover.

They have agreed to give you their graph and you need to find two disjoint subsets of its vertices A and B, such that both A and B are vertex cover or claim it's impossible. Each vertex should be given to no more than one of the friends (or you can even keep it for yourself).

Input

The first line of the input contains two integers n and m (2 ≤ n ≤ 100 000, 1 ≤ m ≤ 100 000) — the number of vertices and the number of edges in the prize graph, respectively.

Each of the next m lines contains a pair of integers ui and vi (1 ≤ ui, vi ≤ n), denoting an undirected edge between ui and vi. It's guaranteed the graph won't contain any self-loops or multiple edges.

Output

If it's impossible to split the graph between Pari and Arya as they expect, print "-1" (without quotes).

If there are two disjoint sets of vertices, such that both sets are vertex cover, print their descriptions. Each description must contain two lines. The first line contains a single integer k denoting the number of vertices in that vertex cover, and the second line contains k integers — the indices of vertices. Note that because of m ≥ 1, vertex cover cannot be empty.

Examples

Input

4 2
1 2
2 3


Output

1
2 
2
1 3 


Input

3 3
1 2
2 3
1 3


Output

-1

Note

In the first sample, you can give the vertex number 2 to Arya and vertices numbered 1 and 3 to Pari and keep vertex number 4 for yourself (or give it someone, if you wish).

In the second sample, there is no way to satisfy both Pari and Arya.

Source: codeforces | Difficulty: MEDIUM
Tags: Graph algorithms

Graph traversal


Solutions:
(n, m) = map(int, input().split())
flag = False
f = [0] * 100001
E = [[] for i in range(n + 1)]
e = [tuple(map(int, input().split())) for _ in range(m)]
for (u, v) in sorted(e):
	E[u] += [v]
	E[v] += [u]

def bfs(nom, col):
	ch = [(nom, col)]
	while ch:
		(v, c) = ch.pop()
		if f[v] == 0:
			f[v] = c
			for u in E[v]:
				if f[u] == 0:
					ch += [(u, 3 - c)]
for x in range(1, n + 1):
	if f[x] == 0:
		bfs(x, 1)
for (u, v) in e:
	if f[u] == f[v]:
		flag = True
		break
if flag:
	print(-1)
else:
	a = [i for i in range(n + 1) if f[i] == 1]
	b = [i for i in range(n + 1) if f[i] == 2]
	print(len(a))
	print(*a)
	print(len(b))
	print(*b)


(n, m) = map(int, input().split())
g = {x: [] for x in range(1, n + 1)}
for item in range(m):
	(u, v) = map(int, input().split())
	g[v].append(u)
	g[u].append(v)
colors = [None] * (n + 1)

def inversecolor(clr):
	return [0, 1][clr == 0]

def solve(g):
	paths = [x for x in g if g[x] != []]
	currentcolor = 0
	colors[paths[-1]] = currentcolor
	while paths:
		current = paths.pop()
		for targetvertex in g[current]:
			if colors[targetvertex] is None:
				colors[targetvertex] = inversecolor(colors[current])
				paths.append(targetvertex)
			elif colors[targetvertex] != inversecolor(colors[current]):
				return '-1'
	return ([x for (x, item) in enumerate(colors) if item == 1], [x for (x, item) in enumerate(colors) if item == 0])
ans = solve(g)
if ans == '-1':
	print(ans)
else:
	a = ans[0]
	b = ans[1]
	print(len(a))
	print(' '.join([str(x) for x in a]))
	print(len(b))
	print(' '.join([str(x) for x in b]))


import sys

def solve():
	(n, m) = [int(x) for x in input().split()]
	E = {i: [] for i in range(n)}
	for i in range(m):
		(u, v) = [int(x) - 1 for x in input().split()]
		E[u].append(v)
		E[v].append(u)
	color = [None] * n
	stack = []
	for v in range(n):
		if color[v] is None:
			stack.append((v, True))
			while stack:
				(u, col) = stack.pop()
				color[u] = col
				for w in E[u]:
					if color[w] is None:
						stack.append((w, not col))
					elif color[w] == col:
						print(-1)
						return None
	A = list(filter(lambda v: color[v - 1], range(1, n + 1)))
	B = list(filter(lambda v: not color[v - 1], range(1, n + 1)))
	if n == 1:
		print(-1)
	elif m == 0:
		print(1)
		print(1)
		print(n - 1)
		print(' '.join(map(str, range(2, n + 1))))
	else:
		print(len(A))
		print(' '.join(map(str, A)))
		print(len(B))
		print(' '.join(map(str, B)))
solve()


from collections import deque
__author__ = 'aste'

def main():
	(n, m) = [int(x) for x in input().split()]
	color = [0] * n
	graph = [[] for i in range(0, n)]
	for i in range(0, m):
		(u, v) = [int(x) - 1 for x in input().split()]
		graph[u].append(v)
		graph[v].append(u)
	res = True
	for i in range(0, n):
		if color[i] != 0:
			continue
		q = deque()
		color[i] = 1
		q.append(i)
		while q:
			v = q.popleft()
			for a in graph[v]:
				if color[a] == 0:
					color[a] = -color[v]
					q.append(a)
				elif color[a] != -color[v]:
					res = False
					break
		if not res:
			break
	if not res:
		print(-1)
	else:
		s1 = []
		s2 = []
		for i in range(0, n):
			if color[i] == 1:
				s1.append(i)
			else:
				s2.append(i)
		print(len(s1))
		print(' '.join((str(x + 1) for x in s1)))
		print(len(s2))
		print(' '.join((str(x + 1) for x in s2)))
main()


def a():
	(_, d) = (int(x) for x in input().split())
	curr_win_streak = 0
	max_win_streak = 0
	for _ in range(d):
		if '0' in input():
			curr_win_streak += 1
		else:
			curr_win_streak = 0
		max_win_streak = max(max_win_streak, curr_win_streak)
	print(max_win_streak)

def b():
	x = input()
	print(x + x[::-1])

def c():
	(nodes_nr, edges_nr) = (int(x) for x in input().split())
	node_idx___neigh_idxes = [[] for _ in range(nodes_nr + 1)]
	for _ in range(edges_nr):
		(n1, n2) = (int(x) for x in input().split())
		node_idx___neigh_idxes[n1].append(n2)
		node_idx___neigh_idxes[n2].append(n1)
	node_idx___color = [-1 for _ in range(nodes_nr + 1)]
	for node_idx in range(1, nodes_nr + 1):
		if node_idx___color[node_idx] != -1:
			continue
		stack = [node_idx]
		node_idx___color[node_idx] = 0
		while stack:
			node = stack.pop()
			curr_color = node_idx___color[node]
			neigh_color = (node_idx___color[node] + 1) % 2
			for neigh in node_idx___neigh_idxes[node]:
				if node_idx___color[neigh] == curr_color:
					print(-1)
					return
				elif node_idx___color[neigh] == -1:
					node_idx___color[neigh] = neigh_color
					stack.append(neigh)
	print(node_idx___color.count(0))
	print(*[idx for (idx, color) in enumerate(node_idx___color) if color == 0])
	print(node_idx___color.count(1))
	print(*[idx for (idx, color) in enumerate(node_idx___color) if color == 1])
c()


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import random
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def main():
	(n, m) = LI()
	aa = [LI() for _ in range(m)]
	e = collections.defaultdict(set)
	for (a, b) in aa:
		e[a].add(b)
		e[b].add(a)
	d = collections.defaultdict(lambda : None)

	def f(i, k):
		q = [(i, k)]
		while q:
			nq = []
			for (i, k) in q:
				if d[i] is not None:
					if d[i] == k:
						continue
					return False
				d[i] = k
				nk = 1 - k
				for c in e[i]:
					nq.append((c, nk))
			q = nq
		return True
	for i in range(n):
		if len(e[i]) > 0 and d[i] is None:
			r = f(i, 0)
			if not r:
				return -1
	a = []
	b = []
	for i in sorted(d.keys()):
		if d[i] is None:
			continue
		if d[i] == 1:
			a.append(i)
		else:
			b.append(i)
	return '\n'.join(map(str, [len(a), ' '.join(map(str, a)), len(b), ' '.join(map(str, b))]))
print(main())


(n, m) = map(int, input().split())
g = [set() for i in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	g[a - 1].add(b - 1)
	g[b - 1].add(a - 1)
a = []
p = [-1] * n
for i in range(n):
	if p[i] != -1:
		continue
	p[i] = 0
	a.append(i)
	while a:
		x = a.pop()
		for elem in g[x]:
			if p[elem] == p[x]:
				print(-1)
				exit(0)
			if p[elem] == -1:
				p[elem] = not p[x]
				a.append(elem)
print(p.count(0))
for i in range(n):
	if p[i] == 0:
		print(i + 1, end=' ')
print()
print(p.count(1))
for i in range(n):
	if p[i] == 1:
		print(i + 1, end=' ')


(n, m) = map(int, input().split())
adj = [[] for i in range(n)]
edges = []
for i in range(m):
	(u, v) = map(int, input().split())
	adj[u - 1].append(v - 1)
	adj[v - 1].append(u - 1)
	edges.append((u - 1, v - 1))
col = [-1] * n
from collections import deque

def BFS(v, c):
	q = deque([(v, c)])
	while q:
		(v, c) = q.pop()
		col[v] = c
		for nv in adj[v]:
			if col[nv] == -1:
				q.append((nv, 1 - c))
for i in range(n):
	if col[i] == -1:
		BFS(i, 0)
if all((col[u] != col[v] for (u, v) in edges)):
	z = [i + 1 for i in range(n) if col[i] == 0]
	o = [i + 1 for i in range(n) if col[i] == 1]
	print(len(z))
	print(*z)
	print(len(o))
	print(*o)
else:
	print(-1)