#include <bits/stdc++.h>
using namespace std;
inline bool is_palindrome(const string& s) {
  return std::equal(s.begin(), s.end(), s.rbegin());
}
const long long MOD = 1000000007;
const long long INF = 1e9 + 5;
const double eps = 1e-7;
const double PI = acos(-1.0);
inline void debug_vi(vector<int> a) {
  for (long long i = (long long)(0); i < (long long)(a.size()); i++)
    cout << a[i] << " ";
}
inline void debug_vll(vector<long long> a) {
  for (long long i = (long long)(0); i < (long long)(a.size()); i++)
    cout << a[i] << " ";
}
const int N = 3005;
vector<int> g[N];
int n, m, k, x, y, z;
set<pair<pair<int, int>, int>> invalid;
vector<pair<int, int>> ee;
int parent[40005], dist[40005];
bool visited[40005];
void printpath(int curr) {
  if (curr == -1) return;
  printpath(parent[curr]);
  if (parent[curr] == -1) {
    cout << ee[curr].first << " ";
  }
  cout << ee[curr].second << " ";
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m >> k;
  for (long long i = (long long)(0); i < (long long)(m); i++) {
    cin >> x >> y;
    ee.push_back({x, y});
    g[x].push_back(2 * i);
    ee.push_back({y, x});
    g[y].push_back(2 * i + 1);
    dist[i] = INF;
  }
  for (long long i = (long long)(0); i < (long long)(k); i++) {
    cin >> x >> y >> z;
    invalid.insert({{x, y}, z});
  }
  memset(visited, false, sizeof(visited));
  queue<int> q;
  memset(parent, -1, sizeof(parent));
  int minm_idx = -1, minm = INF;
  for (auto itr : g[1]) {
    q.push(itr);
    visited[itr] = true;
    dist[itr] = 1;
    if (ee[itr].second == n) {
      cout << 1 << "\n";
      cout << 1 << " " << n << "\n";
      return 0;
    }
  }
  while (!q.empty()) {
    int idx = q.front();
    q.pop();
    tie(x, y) = ee[idx];
    for (int idx2 : g[y]) {
      assert(ee[idx2].first == y);
      int z = ee[idx2].second;
      if (invalid.find({{x, y}, z}) != invalid.end()) continue;
      if (!visited[idx2]) {
        visited[idx2] = true;
        parent[idx2] = idx;
        q.push(idx2);
        dist[idx2] = dist[idx] + 1;
        if (z == n && minm > dist[idx2]) {
          minm_idx = idx2;
          minm = dist[idx2];
        }
      }
    }
  }
  if (minm_idx == -1) {
    cout << -1;
    return 0;
  }
  cout << dist[minm_idx] << "\n";
  printpath(minm_idx);
  return 0;
}
