#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 100000000000000000;
vector<long long> adj[3001];
long long dis[3001][3001];
bool visited[3001][3001];
pair<long long, long long> parent[3001][3001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, i, j, k, t, temp, m;
  cin >> n >> m >> k;
  for (i = 0; i <= n; i++) {
    for (j = 0; j <= n; j++) {
      dis[i][j] = INF;
      visited[i][j] = false;
      parent[i][j] = {-1, -1};
    }
  }
  for (i = 1; i <= m; i++) {
    cin >> j >> t;
    adj[j].push_back(t);
    adj[t].push_back(j);
  }
  set<tuple<long long, long long, long long>> s;
  for (i = 1; i <= k; i++) {
    cin >> j >> temp >> t;
    s.insert({j, temp, t});
  }
  queue<pair<long long, long long>> q;
  dis[1][0] = 0;
  parent[1][0] = {0, 0};
  visited[1][0] = true;
  q.push({1, 0});
  while (!q.empty()) {
    long long node = q.front().first;
    long long parent_p = q.front().second;
    q.pop();
    for (auto x : adj[node]) {
      if (s.find({parent_p, node, x}) == s.end()) {
        if (!visited[x][node]) {
          dis[x][node] = dis[node][parent_p] + 1;
          visited[x][node] = true;
          parent[x][node] = {node, parent_p};
          q.push({x, node});
        }
      }
    }
  }
  long long minima = INF;
  pair<long long, long long> champ;
  for (i = 1; i <= n; i++) {
    if (minima > dis[n][i]) {
      minima = min(minima, dis[n][i]);
      champ = {n, i};
    }
  }
  if (minima == INF) {
    cout << -1 << endl;
    return 0;
  }
  vector<long long> v;
  pair<long long, long long> now;
  now = champ;
  while (now.first > 0) {
    v.push_back(now.first);
    now = parent[now.first][now.second];
  }
  cout << minima << endl;
  for (i = minima; i >= 0; i--) {
    cout << v[i] << " ";
  }
  return 0;
}
