#include <bits/stdc++.h>
using namespace std;
const long double Pi = acos(-1);
const int N = 3e3 + 10, mod = 1e9 + 7;
vector<vector<int>> G;
int n, k, m;
int vis[N][N];
map<pair<pair<int, int>, int>, bool> Map;
int BFS() {
  queue<pair<int, int>> q;
  q.push({-1, 1});
  while (!q.empty()) {
    auto p = q.front();
    q.pop();
    int x = p.first, y = p.second;
    if (y == n) return x;
    for (auto z : G[y]) {
      if (vis[y][z] || Map[{{x, y}, z}]) continue;
      vis[y][z] = x;
      q.push({y, z});
    }
  }
  return -1;
}
void path(pair<int, int> x) {
  vector<int> Path;
  Path.push_back(x.second);
  Path.push_back(x.first);
  while (vis[x.first][x.second] != -1) {
    x = {vis[x.first][x.second], x.first};
    Path.push_back(x.first);
  }
  reverse(Path.begin(), Path.end());
  cout << Path.size() - 1 << '\n';
  for (auto x : Path) cout << x << ' ';
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  cin >> n >> m >> k;
  G.resize(n + 1);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  for (int i = 0; i < k; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    Map[{{x, y}, z}] = 1;
  }
  int x = BFS();
  if (x == -1) return cout << -1 << '\n', 0;
  path({x, n});
  return 0;
}
