Problem: Friends Alex and Bob live in Bertown. In this town there are n crossroads, some of them are connected by bidirectional roads of equal length. Bob lives in a house at the crossroads number 1, Alex — in a house at the crossroads number n.

One day Alex and Bob had a big quarrel, and they refused to see each other. It occurred that today Bob needs to get from his house to the crossroads n and Alex needs to get from his house to the crossroads 1. And they don't want to meet at any of the crossroads, but they can meet in the middle of the street, when passing it in opposite directions. Alex and Bob asked you, as their mutual friend, to help them with this difficult task.

Find for Alex and Bob such routes with equal number of streets that the guys can follow these routes and never appear at the same crossroads at the same time. They are allowed to meet in the middle of the street when moving toward each other (see Sample 1). Among all possible routes, select such that the number of streets in it is the least possible. Until both guys reach their destinations, none of them can stay without moving. 

The guys are moving simultaneously with equal speeds, i.e. it is possible that when one of them reaches some of the crossroads, the other one leaves it. For example, Alex can move from crossroad 1 to crossroad 2, while Bob moves from crossroad 2 to crossroad 3.

If the required routes don't exist, your program should output -1.

Input

The first line contains two integers n and m (2 ≤ n ≤ 500, 1 ≤ m ≤ 10000) — the amount of crossroads and the amount of roads. Each of the following m lines contains two integers — the numbers of crossroads connected by the road. It is guaranteed that no road connects a crossroads with itself and no two crossroads are connected by more than one road.

Output

If the required routes don't exist, output -1. Otherwise, the first line should contain integer k — the length of shortest routes (the length of the route is the amount of roads in it). The next line should contain k + 1 integers — Bob's route, i.e. the numbers of k + 1 crossroads passed by Bob. The last line should contain Alex's route in the same format. If there are several optimal solutions, output any of them.

Examples

Input

2 1
1 2


Output

1
1 2 
2 1 


Input

7 5
1 2
2 7
7 6
2 3
3 4


Output

-1


Input

7 6
1 2
2 7
7 6
2 3
3 4
1 5


Output

6
1 2 3 4 3 2 7 
7 6 7 2 1 5 1 

Solution (in JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;

public class ProblemE {
	
	public static void main(String[] args) throws IOException {
		BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		String[] nm = s.readLine().split(" ");
		int n = Integer.valueOf(nm[0]);
		int m = Integer.valueOf(nm[1]);
		
		List<Integer>[] graph = new List[n];
		for (int i = 0 ; i < n ; i++) {
			graph[i] = new ArrayList<Integer>();
		}
		for (int i = 0 ; i < m ; i++) {
			String[] l = s.readLine().split(" ");
			int a = Integer.valueOf(l[0])-1;
			int b = Integer.valueOf(l[1])-1;
			graph[a].add(b);
			graph[b].add(a);
		}
		
		boolean[][][] dp = new boolean[2][n][n];
		int[][][] dp_prev = new int[2][n][n];
		int[] q = new int[5000000];
		int qh = 0;
		int qt = 0;
		dp[0][0][n-1] = true;
		q[qt++] = 0;
		q[qt++] = 0;
		q[qt++] = n-1;
		while (qt > qh) {
			if (dp[0][n-1][0]) {
				break;
			}
			int turn = q[qh++];
			int a = q[qh++];
			int b = q[qh++];
			if (turn == 0) {
				for (int to : graph[a]) {
					if (!dp[1][to][b]) {
						dp[1][to][b] = true;
						dp_prev[1][to][b] = a;
						q[qt++] = 1;
						q[qt++] = to;
						q[qt++] = b;
					}
				}
			} else {
				for (int to : graph[b]) {
					if (!dp[0][a][to] && a != to) {
						dp[0][a][to] = true;
						dp_prev[0][a][to] = b;
						q[qt++] = 0;
						q[qt++] = a;
						q[qt++] = to;
					}
				}
			}
		}
		if (!dp[0][n-1][0]) {
			out.println(-1);
			out.flush();
			return;
		}
		
		
		int nt = 0;
		int na = n-1;
		int nb = 0;
		List<Integer> ahistory = new ArrayList<Integer>();
		List<Integer> bhistory = new ArrayList<Integer>();
		ahistory.add(n-1);
		bhistory.add(0);
		while (true) {
			if (na == 0 && nb == n - 1) {
				break;
			}
			int tt = 1-nt;
			int ta = na;
			int tb = nb;
			if (nt == 0) {
				tb = dp_prev[nt][na][nb];
				bhistory.add(tb);
			} else {
				ta = dp_prev[nt][na][nb];
				ahistory.add(ta);
			}
			nt = tt;
			na = ta;
			nb = tb;
		}
		
		out.println(ahistory.size() - 1);
		out.println(tostr(ahistory));
		out.println(tostr(bhistory));
		
		out.flush();
	}
	
	private static String tostr(List<Integer> history) {
		Collections.reverse(history);
		StringBuffer b = new StringBuffer();
		for (int x : history) {
			b.append(" ").append(x+1);
		}
		return b.substring(1);
	}

	public static void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}
}