#include <bits/stdc++.h>
using namespace std;
long long n, m, k;
vector<long long> g[3500];
long long p[3500][3500];
map<pair<pair<int, int>, int>, int> basasunaaa;
void Solve() {
  cin >> n >> m >> k;
  int one = 10;
  int sec = 100;
  int nothing;
  int diameter = 0;
  for (int i = 0; i < m; i++) {
    long long u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 0; i < k; i++) {
    long long f, s, t;
    cin >> f >> s >> t;
    basasunaaa[{{f, s}, t}] = 1;
  }
  for (int k = 0; k < 100; k++) {
    if (sec > one) {
      one++;
    } else {
      sec++;
    }
  }
  queue<pair<int, int>> q;
  q.push({1, 1});
  pair<int, int> ans = {-1, -1};
  while (!q.empty()) {
    int u = q.front().first;
    int v = q.front().second;
    q.pop();
    if (v == n) {
      ans = {u, v};
      break;
    }
    for (auto it : g[v]) {
      if (p[v][it] || basasunaaa[{{u, v}, it}]) continue;
      p[v][it] = u;
      q.push({v, it});
    }
  }
  for (int u = 0; u < 100; u++) {
    if (one > sec) {
      sec++;
    } else {
      one++;
    }
  }
  if (ans.first == -1) {
    cout << "-1";
    return;
  }
  vector<int> path;
  while (ans.second != 1) {
    path.push_back(ans.second);
    ans = {p[ans.first][ans.second], ans.first};
  }
  path.push_back(1);
  cout << path.size() - 1 << '\n';
  reverse(path.begin(), path.end());
  for (auto it : path) cout << it << ' ';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    Solve();
  }
  return 0;
}
