#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e3 + 10;
vector<int> lad[maxn];
int dis[maxn][maxn];
pair<int, int> parent[maxn][maxn];
set<pair<int, int>> trips[maxn];
bool valid(int a, int b, int c) {
  return !binary_search(trips[a].begin(), trips[a].end(), make_pair(b, c));
}
int main() {
  int n, m, k, a, b, c, u, v;
  cin >> n >> m >> k;
  for (int i = 0; i < m; ++i) {
    cin >> u >> v;
    u--, v--;
    lad[u].push_back(v);
    lad[v].push_back(u);
  }
  for (int i = 0; i < k; ++i) {
    cin >> a >> b >> c;
    --a, --b, --c;
    trips[a].insert({b, c});
  }
  queue<pair<int, int>> Q;
  Q.push(make_pair(maxn - 1, 0));
  for (int i = 0; i < maxn; ++i)
    for (int j = 0; j < maxn; ++j) dis[i][j] = INT_MAX;
  dis[maxn - 1][0] = 0;
  pair<int, int> ac = {-1, -1};
  while (Q.size() && ac == make_pair(-1, -1)) {
    pair<int, int> x = Q.front();
    Q.pop();
    int p = x.first, h = x.second;
    for (int y : lad[h]) {
      if (dis[h][y] == INT_MAX and valid(p, h, y)) {
        dis[h][y] = dis[p][h] + 1;
        Q.push(make_pair(h, y));
        parent[h][y] = {p, h};
        if (y == n - 1) ac = {h, y};
      }
    }
  }
  if (ac == make_pair(-1, -1)) {
    cout << -1 << endl;
    return 0;
  }
  vector<int> path;
  while (ac.first != maxn - 1) {
    path.push_back(ac.second);
    ac = parent[ac.first][ac.second];
  }
  cout << path.size() << endl << 1 << ' ';
  for (int i = path.size() - 1; i >= 0; --i) cout << path[i] + 1 << ' ';
  return 0;
}
