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
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

/**
 * Created by IntelliJ IDEA.
 * User: Dmitrii
 * Date: 25.03.12
 * Time: 23:30
 * this is http://codeforces.ru/contest/59/submission/1419171 modified:
 * Hash* -> Tree*
 */

public class ShortestPath2 {

    private int vertexAmount;

    private int edgesAmount;

    private int forbiddenTriplesAmount;

    private Graph graph;

    private ForbiddenTriples forbiddenTriples;

    private int[][] dist;

    private int[][] prev;

    public ShortestPath2(BufferedReader stdin) throws IOException {
        getAmounts(stdin);
        graph = buildGraph(stdin);
        forbiddenTriples = getForbiddenTriples(stdin);
        initDistMatrix();
        initPrevMatrix();
    }

    public List<Integer> getShortestPath() {
        makeBFS();
        int prev = findMinEdgeComingToN();
        return collectNodesFromShortestPath(prev);
    }

    private void initDistMatrix() {
        dist = new int[vertexAmount][vertexAmount];
        for (int nI = 0; nI < vertexAmount; nI++) {
            for (int nJ = 0; nJ < vertexAmount; nJ++) {
                dist[nI][nJ] = Integer.MAX_VALUE;
            }
        }
    }

    private void initPrevMatrix() {
        prev = new int[vertexAmount][vertexAmount];
        for (int nI = 0; nI < vertexAmount; nI++) {
            for (int nJ = 0; nJ < vertexAmount; nJ++) {
                prev[nI][nJ] = -1;
            }
        }
    }

    private void makeBFS() {
        Queue<Edge> queue = new LinkedList<Edge>();
        Set<Edge> edgesIncidentToStartVertex = graph.getEdgesById(1);

        for (Edge edge : edgesIncidentToStartVertex) {
            edge.setVisited();
            dist[edge.getStart() - 1][edge.getFinish() - 1] = 1;
            prev[edge.getStart() - 1][edge.getFinish() - 1] = -1;
            queue.offer(edge);
        }

        while (!queue.isEmpty()) {
            Edge e = queue.poll();
            int start = e.getStart();
            int finish = e.getFinish();

            Set<Edge> incidentToV = graph.getEdgesById(finish);
            for (Edge edge : incidentToV) {
                if (!edge.isVisited() && !forbiddenTriples.contains(start, finish, edge.getFinish())) {
                    edge.setVisited();
                    dist[edge.getStart() - 1][edge.getFinish() - 1] = dist[start - 1][finish - 1] + 1;
                    prev[edge.getStart() - 1][edge.getFinish() - 1] = start;
                    queue.offer(edge);
                }
            }
        }
    }

    private int findMinEdgeComingToN() {
        int min = Integer.MAX_VALUE;
        int index = -1;
        for (int nI = 0; nI < vertexAmount; nI++) {
            if (dist[nI][vertexAmount - 1] < min) {
                index = nI;
                min = dist[nI][vertexAmount - 1];
            }
        }
        return index + 1;
    }

    private List<Integer> collectNodesFromShortestPath(int prevIndex) {
        if (prevIndex == 0) {
            return new LinkedList<Integer>();
        } else {
            System.out.println(dist[prevIndex - 1][vertexAmount - 1]);
            List<Integer> path = new LinkedList<Integer>();
            path.add(0, vertexAmount);
            int u = prevIndex;
            int v = vertexAmount;
            while (u != -1) {
                path.add(0, u);
                int oldU = u;
                u = prev[u - 1][v - 1];
                v = oldU;
            }

            return path;
        }
    }

    public void printPath(List<Integer> path) {
        if (path.isEmpty()) {
            System.out.println("-1");
        } else {
            Iterator<Integer> iter = path.iterator();
            StringBuilder sb = new StringBuilder();
            while (iter.hasNext()) {
                sb.append(iter.next());
                if (iter.hasNext()) {
                    sb.append(" ");
                }
            }
            System.out.println(sb.toString());
        }
    }

    private void getAmounts(BufferedReader stdin) throws IOException {
        String line = stdin.readLine();
        String[] lines = line.split(" ");
        vertexAmount = Integer.valueOf(lines[0]);
        edgesAmount = Integer.valueOf(lines[1]);
        forbiddenTriplesAmount = Integer.valueOf(lines[2]);
    }

    private Graph buildGraph(BufferedReader stdin) throws IOException {

        Graph graph = new Graph(vertexAmount);
        for (int nI = 0; nI < edgesAmount; nI++) {
            String edgeAsStr = stdin.readLine();
            String[] verticesAsStr = edgeAsStr.split(" ");
            int vertex1 = Integer.valueOf(verticesAsStr[0]);
            int vertex2 = Integer.valueOf(verticesAsStr[1]);
            graph.addEdge(vertex1, vertex2);
        }

        return graph;
    }

    private ForbiddenTriples getForbiddenTriples(BufferedReader stdin) throws IOException {
        ForbiddenTriples prohibitedTriples = new ForbiddenTriples(vertexAmount);
        for (int nI = 0; nI < forbiddenTriplesAmount; nI++) {
            String edgeAsStr = stdin.readLine();
            String[] verticesAsStr = edgeAsStr.split(" ");
            int vertex1 = Integer.valueOf(verticesAsStr[0]);
            int vertex2 = Integer.valueOf(verticesAsStr[1]);
            int vertex3 = Integer.valueOf(verticesAsStr[2]);
            prohibitedTriples.add(vertex1, vertex2, vertex3);
        }
        return prohibitedTriples;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        ShortestPath2 shortestPath2 = new ShortestPath2(stdin);
        List<Integer> path = shortestPath2.getShortestPath();
        shortestPath2.printPath(path);
    }
}

class Edge implements Comparable<Edge> {

    private int start;

    private int finish;

    private boolean isVisited;

    public Edge(int start, int finish) {
        this.start = start;
        this.finish = finish;
        this.isVisited = false;
    }

    public int getStart() {
        return start;
    }

    public int getFinish() {
        return finish;
    }

    public boolean isVisited() {
        return isVisited;
    }

    public void setVisited() {
        isVisited = true;
    }

    public String toString() {
        return " -> " + finish;
    }

    @Override
    public int compareTo(Edge other) {
        if (start != other.start) {
            return start - other.start;
        } else if (finish != other.finish) {
            return finish - other.finish;
        } else {
            return (isVisited ? 1 : 0) - (other.isVisited ? 1 : 0);
        }
    }
}

class Graph {

    private int vertexAmount;

    private TreeMap<Integer, TreeSet<Edge>> graph;

    public Graph(int vertexAmount) {
        this.vertexAmount = vertexAmount;
        this.graph = new TreeMap<Integer, TreeSet<Edge>>();
        initVertices(vertexAmount);
    }

    public void addEdge(int vertex1, int vertex2) {

        Edge edge1 = new Edge(vertex1, vertex2);
        Edge edge2 = new Edge(vertex2, vertex1);

        addIncidentEdge(vertex1, edge1);
        addIncidentEdge(vertex2, edge2);
    }

    public Set<Edge> getEdgesById(int id) {
        return graph.get(id);
    }

    private void initVertices(int vertexAmount) {
        for (int nI = 1; nI <= vertexAmount; nI++) {
            graph.put(nI, new TreeSet<Edge>());
        }
    }

    private void addIncidentEdge(int vertex, Edge edge) {
        Set<Edge> vertexIncidentEdges = graph.get(vertex);
        vertexIncidentEdges.add(edge);
    }
}

class ForbiddenTriples {

    private Set<Long> forbiddenTriples;

    private int verticesAmount;

    ForbiddenTriples(int verticesAmount) {
        this.verticesAmount = verticesAmount;
        this.forbiddenTriples = new TreeSet<Long>();
    }

    public boolean contains(int vertex1, int vertex2, int vertex3) {
        return forbiddenTriples.contains(hashCode(vertex1, vertex2, vertex3));
    }

    public void add(int vertex1, int vertex2, int vertex3) {
        forbiddenTriples.add(hashCode(vertex1, vertex2, vertex3));
    }

    public long hashCode(int vertex1, int vertex2, int vertex3) {
        return vertex1 + (verticesAmount + 1) * (vertex2 + (verticesAmount + 1) * vertex3);
    }

}
