#include <bits/stdc++.h>
using namespace std;
map<tuple<int, int, int>, bool> path;
queue<pair<int, int> > Q;
vector<vector<int> > g;
pair<int, int> parent[3005][3005];
int dist[3005][3005];
vector<int> ans;
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  g.resize(n + 1);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    g[x].push_back(y);
    g[y].push_back(x);
  }
  for (int i = 1; i <= k; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    path[make_tuple(a, b, c)] = true;
  }
  Q.push(make_pair(1, 0));
  pair<int, int> ind;
  ind.first = -1;
  ind.second = -1;
  while (!Q.empty() && Q.front().second != n) {
    pair<int, int> v = Q.front();
    Q.pop();
    if (v.first == n) {
      ind = make_pair(v.second, v.first);
      break;
    }
    for (int k = 0; k < g[v.first].size(); k++) {
      int to = g[v.first][k];
      if (!path[make_tuple(v.second, v.first, to)] && dist[v.first][to] == 0) {
        Q.push(make_pair(to, v.first));
        dist[v.first][to] = dist[v.second][v.first] + 1;
        parent[v.first][to] = {v.second, v.first};
      }
    }
  }
  if (ind.first == -1 || ind.second == -1) {
    cout << -1;
    return 0;
  }
  cout << dist[ind.first][ind.second] << endl;
  while (ind.first != 0) {
    ans.push_back(ind.second);
    ind = parent[ind.first][ind.second];
  }
  cout << 1 << ' ';
  for (int i = ans.size() - 1; i >= 0; i--) cout << ans[i] << ' ';
  return 0;
}
