#include <bits/stdc++.h>
using namespace std;
pair<int, int> pr[3001][3001];
vector<int> edge[3001];
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cout << fixed << setprecision(20);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      pr[i][j] = {-1, -1};
    }
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  set<pair<pair<int, int>, int>> bad;
  for (int i = 0; i < k; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--, b--, c--;
    bad.insert({{a, b}, c});
  }
  pr[0][0] = {-2, -2};
  queue<pair<int, int>> q;
  q.push({0, 0});
  pair<int, int> last = {-1, -1};
  while (!q.empty()) {
    auto p = q.front();
    if (p.second == n - 1) {
      last = p;
      break;
    }
    q.pop();
    for (int v : edge[p.second]) {
      if (!bad.count({p, v}) && pr[p.second][v] == make_pair(-1, -1)) {
        pr[p.second][v] = p;
        q.push({p.second, v});
      }
    }
  }
  if (last == make_pair(-1, -1)) {
    cout << -1 << endl;
    return 0;
  }
  vector<int> ans;
  while (last != make_pair(-2, -2)) {
    ans.push_back(last.second);
    last = pr[last.first][last.second];
  }
  reverse(ans.begin(), ans.end());
  cout << ans.size() - 1 << endl;
  for (int v : ans) {
    cout << v + 1 << " ";
  }
  return 0;
}
