#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int dist[3005][3005];
vector<int> adj[3005];
pair<int, int> path[3005][3005];
set<tuple<int, int, int>> forbid;
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 0; i < k; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    forbid.insert(tuple<int, int, int>(a, b, c));
  }
  memset(dist, 0x3f3f3f3f, sizeof dist);
  queue<pair<int, int>> q;
  dist[1][1] = 0;
  q.push({1, 1});
  while (!q.empty()) {
    int u = q.front().first;
    int v = q.front().second;
    q.pop();
    for (auto it : adj[v]) {
      if (!forbid.count(tuple<int, int, int>(u, v, it)) &&
          dist[v][it] > 1 + dist[u][v]) {
        dist[v][it] = 1 + dist[u][v];
        path[v][it] = {u, v};
        q.push({v, it});
      }
    }
  }
  int best = 0x3f3f3f3f;
  pair<int, int> ans;
  for (int i = 1; i <= n; i++) {
    if (dist[i][n] < best) {
      best = dist[i][n];
      ans = {i, n};
    }
  }
  if (best == 0x3f3f3f3f) {
    cout << -1 << '\n';
    return 0;
  }
  cout << best << '\n';
  vector<int> vi;
  for (auto u = ans; u.second != 1; u = path[u.first][u.second]) {
    vi.push_back(u.second);
  }
  vi.push_back(1);
  for (int i = vi.size() - 1; i >= 0; i--) {
    cout << vi[i] << ' ';
  }
  cout << '\n';
  return 0;
}
