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 *a*<sub class="lower-index">*i*</sub>, *b*<sub class="lower-index">*i*</sub>, *c*<sub class="lower-index">*i*</sub> 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: *a*<sub class="lower-index">*i*</sub>, *c*<sub class="lower-index">*i*</sub>, *b*<sub class="lower-index">*i*</sub>. 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.
The first line contains three integers *n*, *m*, *k* (2 ≤ *n* ≤ 3000, 1 ≤ *m* ≤ 20000, 0 ≤ *k* ≤ 10<sup class="upper-index">5</sup>) 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 *x*<sub class="lower-index">*i*</sub>, *y*<sub class="lower-index">*i*</sub> (1 ≤ *x*<sub class="lower-index">*i*</sub>, *y*<sub class="lower-index">*i*</sub> ≤ *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 *a*<sub class="lower-index">*i*</sub>, *b*<sub class="lower-index">*i*</sub>, *c*<sub class="lower-index">*i*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub>, *b*<sub class="lower-index">*i*</sub>, *c*<sub class="lower-index">*i*</sub> ≤ *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.
import sys
import sys, threading
from heapq import heapify, heappop, heappush
from math import log10, floor, pow, gcd, sqrt, inf
from collections import defaultdict, deque, Counter
input = sys.stdin.readline
 
 
############ ---- Input Functions ---- ############
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))

    
def main():
    cities, roads, triplet = inlt()
    edges = defaultdict(list)
    
    triplets = set()
    for _ in range(roads):
        pointA, pointB = inlt()
        edges[pointA].append(pointB)
        edges[pointB].append(pointA)
    
    for _ in range(triplet):
        triplets.add(tuple(inlt()))
    
    # print(edges)
    
    
    visited = defaultdict(int)
    final = int("1"*(cities+1),2)
    
    qu = deque([[(1, 1<<1 ),"1"]])
    counts = 0
    while qu:
        x, count = qu.popleft()
        node, comb = x
        # print(comb)
 
        if len(count) >= 3:
            danger = (int(count[-3]), int(count[-2]), int(count[-1]))
            if danger in triplets:
                continue
        if x[0] == cities:
            print(len(count) -1)
            for i in count:
                print(i, end=" ")
            return
        if visited[x] == 2:
            continue
        
        
        visited[x] += 1
        
        for i in edges[node]:
            tmp = 1<<i
            count += str(i)
            qu.append([(i,tmp|comb),count])
            count = count[:-1]
    print(-1)
                
main()          
# threading.stack_size(1 << 27)
# sys.setrecursionlimit(1 << 30)
# main_thread = threading.Thread(target=main)
# main_thread.start()
# main_thread.join()