#include <bits/stdc++.h>
using namespace std;
int n, m, k, u, v, i, a, b, c, d[3000][3000], p[3000][3000];
set<pair<int, pair<int, int> > > s;
vector<int> g[3000];
queue<pair<int, int> > q;
void output(int parent, int v) {
  if (p[parent][v] != 0 || v != 0) output(p[parent][v], parent);
  cout << v + 1 << " ";
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie();
  cin >> n >> m >> k;
  for (i = 0; i < m; i++) {
    cin >> u >> v;
    u--;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (i = 0; i < k; i++) {
    cin >> a >> b >> c;
    a--;
    b--;
    c--;
    s.insert({a, {b, c}});
  }
  q.push({0, 0});
  d[0][0] = 1;
  while (!q.empty()) {
    v = q.front().first;
    int parent = q.front().second;
    q.pop();
    for (i = 0; i < g[v].size(); i++) {
      int to = g[v][i];
      if (s.find({parent, {v, to}}) == s.end()) {
        if (d[v][to] == 0 || d[v][to] > d[parent][v] + 1) {
          d[v][to] = d[parent][v] + 1;
          p[v][to] = parent;
          q.push({to, v});
        }
      }
    }
  }
  int MIN = 1000000000;
  for (i = 0; i < n; i++) {
    if (d[i][n - 1] < MIN && d[i][n - 1] != 0) {
      MIN = d[i][n - 1];
      v = i;
    }
  }
  if (MIN == 1000000000) {
    cout << -1;
    return 0;
  }
  cout << MIN - 1 << endl;
  output(v, n - 1);
  return 0;
}
