#include <bits/stdc++.h>
using namespace std;
const int mxN = 3e3 + 37;
vector<int> adj[mxN];
vector<int> qq[mxN][mxN];
int p[mxN][mxN];
void add(int u, int v) {
  adj[u].push_back(v);
  adj[v].push_back(u);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  memset(p, -1, sizeof(p));
  p[0][0] = 0;
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    add(u, v);
  }
  for (int i = 0; i < k; ++i) {
    int u, v, a;
    cin >> u >> v >> a;
    qq[u][v].push_back(a);
    sort(qq[u][v].begin(), qq[u][v].end());
  }
  queue<array<int, 3>> q;
  q.push({1, 1, 0});
  while (!q.empty()) {
    auto [po, u, d] = q.front();
    if (u == n) {
      break;
    }
    q.pop();
    for (auto &v : adj[u]) {
      if (p[u][v] != -1) {
        continue;
      }
      auto pt = lower_bound(qq[po][u].begin(), qq[po][u].end(), v);
      if (pt != qq[po][u].end() && *pt == v) continue;
      q.push({u, v, d + 1});
      p[u][v] = po;
    }
  }
  if (q.empty()) return cout << -1 << "\n", 0;
  cout << q.front()[2] << "\n";
  vector<int> path;
  array<int, 2> qp = {q.front()[0], q.front()[1]};
  do {
    path.push_back(qp[1]);
    int pqp = p[qp[0]][qp[1]];
    qp[1] = qp[0];
    qp[0] = pqp;
  } while (qp[1] != path.back());
  reverse(path.begin(), path.end());
  for (auto i : path) cout << i << " ";
}
