#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e3 + 10, inf = 1e9 + 10;
int n, m, k, d[maxn][maxn], dad[maxn][maxn];
set<pair<int, pair<int, int>>> S;
vector<int> g[maxn];
bool mark[maxn][maxn];
void add(int a, int b) {
  g[a].push_back(b);
  g[b].push_back(a);
}
void bfs() {
  queue<pair<pair<int, int>, int>> q;
  q.push({{0, 1}, 0});
  while ((int)q.size()) {
    int v = q.front().first.second, p = q.front().first.first,
        D = q.front().second;
    q.pop();
    if (mark[p][v]) continue;
    mark[p][v] = 1;
    for (int u : g[v]) {
      if (!S.count({p, {v, u}})) {
        if (D + 1 < d[v][u]) dad[v][u] = p;
        d[v][u] = min(d[v][u], D + 1);
        q.push({{v, u}, D + 1});
      }
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  for (int i = 0; i < maxn; i++)
    for (int j = 0; j < maxn; j++) d[i][j] = inf;
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    add(a, b);
  }
  for (int i = 0; i < k; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    S.insert({a, {b, c}});
  }
  bfs();
  vector<int> ans;
  ans.push_back(n);
  int j, cur = inf;
  for (int i = 1; i <= n; i++) {
    if (d[i][n] < cur) j = i;
    cur = min(cur, d[i][n]);
  }
  pair<int, int> now = {j, n};
  if (cur == inf) return cout << -1 << '\n', 0;
  while (1) {
    int p = dad[now.first][now.second];
    if (!p) break;
    ans.push_back(now.first);
    now = {p, now.first};
  }
  reverse(ans.begin(), ans.end());
  cout << cur << '\n' << 1 << ' ';
  for (int i : ans) cout << i << ' ';
  cout << '\n';
  return 0;
}
