In Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller visits three cities ai, bi, ci in row, without visiting other cities between them, a great disaster awaits him. Overall there are k such city triplets. Each triplet is ordered, which means that, for example, you are allowed to visit the cities in the following order: ai, ci, bi. Vasya wants to get from the city 1 to the city n and not fulfil the superstition. Find out which minimal number of roads he should take. Also you are required to find one of his possible path routes.

Input

The first line contains three integers n, m, k (2 ≤ n ≤ 3000, 1 ≤ m ≤ 20000, 0 ≤ k ≤ 105) which are the number of cities, the number of roads and the number of the forbidden triplets correspondingly. 

Then follow m lines each containing two integers xi, yi (1 ≤ xi, yi ≤ n) which are the road descriptions. The road is described by the numbers of the cities it joins. No road joins a city with itself, there cannot be more than one road between a pair of cities. 

Then follow k lines each containing three integers ai, bi, ci (1 ≤ ai, bi, ci ≤ n) which are the forbidden triplets. Each ordered triplet is listed mo more than one time. All three cities in each triplet are distinct.

City n can be unreachable from city 1 by roads.

Output

If there are no path from 1 to n print -1. Otherwise on the first line print the number of roads d along the shortest path from the city 1 to the city n. On the second line print d + 1 numbers — any of the possible shortest paths for Vasya. The path should start in the city 1 and end in the city n.

Examples

Input

4 4 1
1 2
2 3
3 4
1 3
1 4 3


Output

2
1 3 4


Input

3 1 0
1 2


Output

-1


Input

4 4 2
1 2
2 3
3 4
1 3
1 2 3
1 3 4


Output

4
1 3 2 3 4
/*
 * akshaygupta26
 */
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Scanner; 
import java.util.Random;
import java.util.Arrays;
import java.util.StringTokenizer; 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Collections;
import java.util.*;
public class B 
{ 
	static class Pair{
		int par;
		int dest;
		long wt;
		String path;
		Pair(){}
		Pair(int p,int d,long w){
			par=p;
			dest=d;
			wt=w;
		}
	}
	
	static class customSort implements Comparator<Pair>{
		public  int compare(Pair a,Pair b) {
			if(a.wt<b.wt) return -1;
			else if(a.wt>b.wt) return 1;
			return 0;
		}
	}
	static long dist[];
	static HashMap<Integer,HashMap<Integer,HashSet<Integer>>> restricted=new HashMap<>();
	static StringBuffer ans=new StringBuffer();
	static PrintWriter pw=new PrintWriter(System.out);
    public static void main(String[] args) 
	{ 
		FastReader sc=new FastReader(); 
		
		int test=1;
		while(test-->0)
		{
			int n=sc.nextInt(),m=sc.nextInt(),k=sc.nextInt();
			ArrayList<Pair> arr[]=new ArrayList[n+1];
			
			for(int i=0;i<=n;i++) arr[i]=new ArrayList<>();
			dist=new long[n+1];Arrays.fill(dist, Long.MAX_VALUE);
			for(int i=0;i<m;i++) {
				int a=sc.nextInt();
				int b=sc.nextInt();
				long wt=1;
				arr[a].add(new Pair(a,b,wt));
				arr[b].add(new Pair(b,a,wt));
			}
			
			
			for(int i=0;i<k;i++) {
				int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt();
				if(!restricted.containsKey(a)) restricted.put(a,new HashMap<>());
				if(!restricted.get(a).containsKey(b)) restricted.get(a).put(b,new HashSet<>());
				restricted.get(a).get(b).add(c);
			}
			
			djikstra(1,n,arr);

		}
		
	    System.out.print(ans);
	} 
        
    static void djikstra(int source,int n,ArrayList<Pair> arr[]) {
    	PriorityQueue<Pair> pq=new PriorityQueue<>(new customSort());
	
    	pq.add(new Pair(0,source,0));
    	
    	long dp[][]=new long[n+1][n+1];
    	for(int i=0;i<=n;i++) Arrays.fill(dp[i], Long.MAX_VALUE);
    	boolean vis[][]=new boolean[n+1][n+1];
    	dp[1][0]=0;
    	while(!pq.isEmpty()) {
    		Pair x=pq.poll();
    		int nd=x.dest;long wt=x.wt;int par=x.par;
    		
    		
    		if(dp[nd][par]<wt || vis[nd][par]) continue;
    	    
    		vis[nd][par]=true;
    		if(nd == n) {
    			break;
    		}
    		for(Pair y:arr[nd]) {
    			int ch=y.dest;long wtc=y.wt;
    			if(valid(par,nd,ch) && dp[ch][nd]>wt+wtc) {
    				dp[ch][nd]=wt+wtc;
    				pq.add(new Pair(nd,ch,wt+wtc));
    			}
    		}
    	}
    	int mini=0;
    	for(int i=1;i<n;i++)
    		if(dp[n][i]<dp[n][mini])
    			mini=i;
    	
    	if(mini == 0) {
    		System.out.println(-1);System.exit(0);
    	}
    	
    	ArrayList<Integer> res=new ArrayList<>();
    	res.add(n);
    	int nd=mini;
    	int ch=n;
    	long cost=dp[n][mini];
    	long prvEdge=calEdgCost(nd,n,arr);
    	boolean taken[]=new boolean[n+1];
    	taken[n]=true;
    	int cnt=0;
    	while(nd>0) {

    		++cnt;
    		res.add(nd);
    		mini=0;

    		for(Pair x:arr[nd]) {
    			int i=x.dest;
    			if(taken[i] || i == nd) continue;
    			if(dp[nd][i]+prvEdge == cost && valid(i,nd,ch)) {
    				mini=i;
    			}
    		}
    		cost=dp[nd][mini];
    		prvEdge =calEdgCost(mini,nd,arr);
    		taken[mini]=true;
    		ch=nd;
    		nd=mini;
    		
    	}
    	
    	StringBuffer str=new StringBuffer();
    	for(int i=res.size()-1;i>=0;i--) {
    		str.append(res.get(i)+" ");
    	}
    	
    	pw.print(cnt+"\n"+str);
    	pw.close();
    	    	
    }
    
    static long calEdgCost(int a,int b,ArrayList<Pair> arr[]) {
    	for(Pair x:arr[a]) {
    		if(x.dest == b) return x.wt;
    	}
    	return 0;
    }
    static boolean valid(int a,int b,int c) {
    	if(restricted.containsKey(a)) {
    		if(restricted.get(a).containsKey(b)) {
    			if(restricted.get(a).get(b).contains(c)) {
        			return false;
        		}
    		}
    	}
    	return true;
    }
    
    static final Random random=new Random();
    
	static void ruffleSort(int[] a) {
		int n=a.length;//shuffle, then sort 
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
	
	static void ruffleSort(long[] a) {
		int n=a.length;//shuffle, then sort 
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n);
			long temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
	
	static class FastReader 
	{ 
		BufferedReader br; 
		StringTokenizer st; 

		public FastReader() 
		{ 
			br = new BufferedReader(new
					InputStreamReader(System.in)); 
		} 

		String next() 
		{ 
			while (st == null || !st.hasMoreElements()) 
			{ 
				try
				{ 
					st = new StringTokenizer(br.readLine()); 
				} 
				catch (IOException e) 
				{ 
					e.printStackTrace(); 
				} 
			} 
			return st.nextToken(); 
		} 

		int nextInt() 
		{ 
			return Integer.parseInt(next()); 
		} 

		long nextLong() 
		{ 
			return Long.parseLong(next()); 
		} 

		double nextDouble() 
		{ 
			return Double.parseDouble(next()); 
		} 

		String nextLine() 
		{ 
			String str = ""; 
			try
			{ 
				str = br.readLine(); 
			} 
			catch (IOException e) 
			{ 
				e.printStackTrace(); 
			} 
			return str; 
		} 
	} 


} 
