#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int maxn = 3e3 + 1, inf = 1 << 30;
vector<int> adj[maxn];
vector<int> *cant_go[maxn][maxn], *cant_go_rev[maxn][maxn];
int dist[maxn][maxn];
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  while (m--) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  while (k--) {
    int a, b, c;
    cin >> a >> b >> c;
    a--, b--, c--;
    if (!cant_go[a][b]) cant_go[a][b] = new vector<int>();
    cant_go[a][b]->push_back(c);
    if (!cant_go_rev[c][b]) cant_go_rev[c][b] = new vector<int>();
    cant_go_rev[c][b]->push_back(a);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (cant_go[i][j]) sort((cant_go[i][j])->begin(), (cant_go[i][j])->end());
      if (cant_go_rev[i][j])
        sort((cant_go_rev[i][j])->begin(), (cant_go_rev[i][j])->end());
    }
  }
  fill_n(*dist, maxn * maxn, inf);
  queue<pii> q;
  dist[n][0] = 0;
  q.emplace(n, 0);
  while (!q.empty()) {
    int p = q.front().first, u = q.front().second;
    q.pop();
    if (u == n - 1) break;
    for (int v : adj[u]) {
      if (cant_go[p][u] &&
          binary_search((cant_go[p][u])->begin(), (cant_go[p][u])->end(), v))
        continue;
      if (dist[u][v] != inf) continue;
      dist[u][v] = dist[p][u] + 1;
      q.emplace(u, v);
    }
  }
  vector<int> path{n};
  for (int u = n - 1, p = n; u;) {
    int min_dist = inf, min_par = -1;
    for (int i = 0; i < n; i++) {
      if (cant_go_rev[p][u] && binary_search((cant_go_rev[p][u])->begin(),
                                             (cant_go_rev[p][u])->end(), i))
        continue;
      if (min_dist > dist[i][u]) {
        min_dist = dist[i][u];
        min_par = i;
      }
    }
    if (~min_par) {
      path.push_back(min_par + 1);
      p = u;
      u = min_par;
    } else
      break;
  }
  if (int((path).size()) == 1)
    cout << -1;
  else {
    cout << int((path).size()) - 1 << '\n';
    reverse((path).begin(), (path).end());
    for (int u : path) cout << u << ' ';
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int tcs = 1;
  for (int tc = 1; tc <= tcs; tc++) {
    solve();
  }
}
