#include <bits/stdc++.h>
using namespace std;
int par[3001][3001];
int main() {
  int n, m, k, a, b, c;
  cin >> n >> m >> k;
  vector<int> g[n + 1];
  int i;
  int temp1, temp2;
  for (int i = 0; i < m; i++) {
    cin >> temp1 >> temp2;
    g[temp1].push_back(temp2);
    g[temp2].push_back(temp1);
  }
  map<pair<pair<int, int>, int>, int> triplet;
  for (int i = 0; i < k; i++) {
    cin >> a >> b >> c;
    triplet[{{a, b}, c}] = 1;
  }
  memset(par, -1, sizeof(par));
  queue<pair<int, int> > q;
  q.push({1, 1});
  pair<int, int> ans = {-1, -1};
  while (!q.empty()) {
    pair<int, int> v = q.front();
    q.pop();
    if (v.second == n) {
      ans = v;
      break;
    }
    for (int j : g[v.second]) {
      if (triplet[{v, j}] != 1 and par[v.second][j] == -1) {
        q.push({v.second, j});
        par[v.second][j] = v.first;
      }
    }
  }
  if (ans.first == -1) {
    cout << "-1"
         << "\n";
  } else {
    vector<int> path;
    int temp;
    temp1 = ans.first;
    temp2 = ans.second;
    while (temp2 != 1) {
      path.push_back(temp2);
      temp = par[temp1][temp2];
      temp2 = temp1;
      temp1 = temp;
    }
    path.push_back(1);
    cout << path.size() - 1 << "\n";
    for (int i = path.size() - 1; i >= 0; i--) cout << path[i] << ' ';
  }
  return 0;
}
