#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const double err = 1e-12;
const double PI = 3.141592653589793;
const int N = 1e5 + 5;
int n, m, k;
vector<vector<int>> adj;
set<vector<int>> forb;
priority_queue<pair<int, pair<int, int>>, vector<pair<int, pair<int, int>>>,
               greater<pair<int, pair<int, int>>>>
    pq;
vector<vector<int>> dis;
vector<vector<int>> par;
void solve() {
  cin >> n >> m >> k;
  adj = vector<vector<int>>(n);
  dis = vector<vector<int>>(n, vector<int>(n, INT_MAX));
  par = vector<vector<int>>(n, vector<int>(n, -1));
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  for (int i = 0; i < k; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    --a, --b, --c;
    forb.insert({a, b, c});
  }
  pq.push({0, {0, 0}});
  dis[0][0] = 0;
  while (!pq.empty()) {
    auto t = pq.top();
    pq.pop();
    auto pr = t.second;
    if (dis[pr.first][pr.second] != t.first) continue;
    for (auto i : adj[pr.second]) {
      if (1 + dis[pr.first][pr.second] < dis[pr.second][i] &&
          forb.find({pr.first, pr.second, i}) == forb.end()) {
        dis[pr.second][i] = 1 + dis[pr.first][pr.second];
        par[pr.second][i] = pr.first;
        if (i == n - 1) break;
        pq.push({dis[pr.second][i], {pr.second, i}});
      }
    }
  }
  int mn = INT_MAX, idx = -1;
  for (int i = 0; i < n - 1; i++) {
    if (dis[i][n - 1] < mn) {
      mn = dis[i][n - 1];
      idx = i;
    }
  }
  if (idx == -1)
    cout << -1 << endl;
  else {
    cout << mn << "\n";
    vector<int> path;
    path.push_back(n);
    int prev = n - 1;
    while (par[idx][prev] != -1) {
      path.push_back(idx + 1);
      int tmp = prev;
      prev = idx;
      idx = par[idx][tmp];
    }
    reverse(path.begin(), path.end());
    for (auto i : path) cout << i << ' ';
    cout << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  while (t--) solve();
  return 0;
}
