 #include <bits/stdc++.h>

 using namespace std ;
 
  #define sz(v) (int)v.size()
  #define ll long long
  #define all(v) v.begin() , v.end()
  #define rall(v) v.rbegin() , v.rend()
  #define pf push_front
  #define pb push_back
  #define fast FastInputOutput() ;
  #define Clear( container , value ) memset( container , value , sizeof container )
  #define PI acos( -1.0 )
  #define c_b fflush(stdin);
 
  int dx[ ] = { 0 , 0 , -1 , 1 , 1 , -1 , 1 , 1 } ;
  int dy[ ] = { -1 , 1 , 0 , 0 , 1 , -1 ,-1 ,-1 } ;
 
  void File_input( string pathIn , string pathOut ) {
  freopen( pathIn.c_str() , "r", stdin ) ;
  freopen( pathOut.c_str() , "w", stdout ) ;
  }
 
  void FastInputOutput() {
  ios_base :: sync_with_stdio( 0 ) ;
  cin.tie( 0 ) ;
  cout.tie( 0 ) ;
  }
 
  const int N = 3e3 + 5 ;
  int n , m , k , f , t , z ;
  vector < int > adj[ N ] ;
  int so_far[ N ] ;
 map < pair < int , pair < int , int > > , bool > tribe ;
  map < pair < int , int > , pair < int , int > > par ;
 
  void dijistra(){
  par[ { 1 , so_far[ 1 ] } ] = { -1 , -1 } ;
  queue < pair < int , int > > an ;
  for( int i = 0 ; i < sz( adj[ 1 ] ) ; i++ ){
  an.push( { adj[ 1 ][ i ] , 1 } ) ;
  par[ { adj[ 1 ][ i ] , so_far[ adj[ 1 ][ i ] ] } ] ;
  so_far[ adj[ 1 ][ i ] ]--;
  so_far[ 1 ]-- ;
  }
  while( sz( an ) ){
  int cur = an.front().first ;
  int parent = an.front().second ;
  an.pop() ;
  if( cur == n ){
 
  pair < int , int > t ;
  t = { n , sz( adj[ n ] ) } ;
  vector < int > path ;
  while( t.first != -1 && t.second != -1 ){
  path.pb( t.first ) ;
  cout << t.first << " " ;
  t = par[ { t.first , t.second } ] ;
  }
 
 
  return;
  }
  for( auto node : adj[ cur ] ){
  if( tribe[ { parent , { cur , node } } ] ) continue ;
  if( so_far[ node ] ){
  par[ { node , so_far[ node ] } ] = { parent , so_far[ parent ] } ;
  so_far[ node ]-- ;
  so_far[ parent ]-- ;
  an.push( { node , cur } ) ;
  }
  }
  }
  cout << "-1" ;
  }
 
  int main(){
 
  scanf("%d%d%d" , &n , &m , &k ) ;
 
  if( m == 1 ){
  puts("-1") ;
  return 0;
  }
 
  while( m-- ){
  scanf("%d%d" , &f , &t ) ;
  so_far[ f ] += 1 ;
  so_far[ t ] += 1 ;
  adj[ f ].pb( t ) ;
  adj[ t ].pb( f ) ;
  }
 
 
 
  while( k-- ){
  scanf("%d%d%d" , &f , &t , &z ) ;
  tribe[ { f , { t , z } } ] = 1 ;
  }


 dijistra();




 return 0 ;
}