#include <bits/stdc++.h>
struct Sign {
  int cityA;
  int cityB;
  int cityC;
  bool operator<(const Sign& s) const {
    if (cityA < s.cityA) return true;
    if (cityA == s.cityA) {
      if (cityB < s.cityB) return true;
      if (cityB == s.cityB)
        if (cityC < s.cityC) return true;
    }
    return false;
  }
};
struct CityInf {
  int city;
  int prCity;
  int length;
  bool operator<(const CityInf& p) const { return length > p.length; };
};
int main(int argc, char** argv) {
  int n, m, k;
  int i, u, v;
  std::cin >> n >> m >> k;
  bool* tmp = new bool[n * n];
  bool** graph = new bool*[n];
  for (i = 0; i < n; i++) graph[i] = tmp + i * n;
  for (u = 0; u < n; u++) std::fill_n(graph[u], n, false);
  for (i = 0; i < m; i++) {
    std::cin >> u >> v;
    graph[--u][--v] = true;
    graph[v][u] = true;
  }
  std::set<Sign> badSign;
  Sign sTmp;
  for (i = 0; i < k; i++) {
    std::cin >> sTmp.cityA >> sTmp.cityB >> sTmp.cityC;
    (sTmp.cityA)--;
    (sTmp.cityB)--;
    (sTmp.cityC)--;
    badSign.insert(sTmp);
  }
  std::priority_queue<CityInf> Q;
  std::vector<CityInf> passedCities;
  CityInf uInf = {0, 0, 0};
  Q.push(uInf);
  while (!Q.empty()) {
    uInf = Q.top();
    Q.pop();
    u = uInf.city;
    bool is_alone = true;
    if (u == n - 1)
      break;
    else {
      for (v = 0; v < n; v++)
        if (graph[u][v]) {
          Sign sTmp = {uInf.prCity, u, v};
          if (badSign.count(sTmp) == 0) {
            is_alone = false;
            CityInf tmp = {v, u, uInf.length + 1};
            Q.push(tmp);
            graph[u][v] = false;
          }
        }
      if (!is_alone) passedCities.push_back(uInf);
    }
  }
  if (uInf.city == n - 1) {
    std::vector<int> ans;
    std::cout << uInf.length << std::endl;
    ans.push_back(uInf.city + 1);
    for (i = static_cast<int>(passedCities.size() - 1); i >= 0; i--) {
      CityInf currentInf = passedCities[i];
      if (uInf.prCity == currentInf.city && uInf.length > currentInf.length) {
        uInf = currentInf;
        ans.push_back(uInf.city + 1);
      }
    }
    while (!ans.empty()) {
      std::cout << ans.back() << " ";
      ans.pop_back();
    }
  } else
    std::cout << "-1" << std::endl;
  delete[] graph;
  delete[] tmp;
  return 0;
}
