#include <bits/stdc++.h>
using namespace std;
vector<long long> v[3001];
long long visited[3001][3001];
long long poss[3001];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m, k;
  cin >> n >> m >> k;
  pair<long long, long long> parent[n + 1][n + 1];
  for (long long i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  set<tuple<long long, long long, long long>> s;
  for (long long i = 0; i < k; i++) {
    long long a, b, c;
    cin >> a >> b >> c;
    s.insert({a, b, c});
  }
  queue<pair<long long, long long>> q;
  q.push({1, 1});
  visited[1][1] = 1;
  parent[1][1] = {-1, -1};
  poss[1] = 1;
  pair<long long, long long> last = {-1, -1};
  while (!q.empty()) {
    pair<long long, long long> node = q.front();
    if (node.second == n) {
      last = {node};
      break;
    }
    q.pop();
    for (auto c : v[node.second]) {
      if (visited[node.second][c] == 0 &&
          !s.count({node.first, node.second, c})) {
        parent[node.second][c] = node;
        visited[node.second][c] = visited[node.first][node.second] + 1;
        poss[c] = 1;
        q.push({node.second, c});
      }
    }
  }
  if (poss[n]) {
    vector<long long> ans;
    pair<long long, long long> start = last;
    while ((parent[start.first][start.second]) != parent[1][1]) {
      ans.push_back(start.second);
      start = parent[start.first][start.second];
    }
    ans.push_back(start.second);
    reverse(ans.begin(), ans.end());
    cout << ans.size() - 1 << "\n";
    for (auto c : ans) cout << c << " ";
  } else
    cout << -1 << "\n";
  return 0;
}
