#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void hash_combine(size_t &seed, const T &value) {
  seed ^= hash<T>()(value) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
}
template <typename T>
inline void hash_val(size_t &seed, const T &val) {
  hash_combine(seed, val);
}
template <typename T, typename... Types>
inline void hash_val(size_t &seed, const T &val, const Types &...args) {
  hash_combine(seed, val);
  hash_val(seed, args...);
}
template <typename... Types>
inline size_t hash_val(const Types &...args) {
  size_t seed = 0;
  hash_val(seed, args...);
  return seed;
}
struct ob {
  int a, b, c;
  ob() {}
  ob(int x, int y, int z) : a(x), b(y), c(z) {}
  bool operator==(const ob &x) const {
    return a == x.a && b == x.b && c == x.c;
  }
};
class obHash {
 public:
  std::size_t operator()(const ob &c) const { return hash_val(c.a, c.b, c.c); }
};
unordered_set<ob, obHash> ban;
const int MAX = 3020, MAX2 = 1e5 + 20;
int n, m, k;
queue<pair<int, int> > Q;
vector<int> adj[MAX];
int vist[MAX][MAX];
pair<int, int> pa[MAX][MAX];
int L[MAX][MAX];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = (0); i <= (m - 1); ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    adj[a].push_back(b), adj[b].push_back(a);
  }
  for (int i = (0); i <= (k - 1); ++i) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    ban.insert({a, b, c});
  }
  memset(vist, 0, sizeof(vist));
  pair<int, int> ans = {-1, -1};
  for (int i = (0); i <= ((int)adj[n].size() - 1); ++i) {
    Q.push({n, adj[n][i]}), L[n][adj[n][i]] = 1, vist[n][adj[n][i]] = 1,
                            pa[n][adj[n][i]] = {-1, -1};
    if (adj[n][i] == 1) {
      ans = {n, adj[n][i]};
      goto L1;
    }
  }
  int a, b, c;
  while (!Q.empty()) {
    pair<int, int> p = Q.front();
    a = p.first, b = p.second;
    Q.pop();
    for (int i = 0; i < adj[b].size(); i++) {
      c = adj[b][i];
      if (ban.find({c, b, a}) == ban.end()) {
        for (int j = 0; j < adj[c].size(); j++) {
          if (vist[b][c] == 0) {
            L[b][c] = L[a][b] + 1;
            pa[b][c] = {a, b};
            vist[b][c] = 1;
            if (c == 1) {
              ans = {b, c};
              goto L1;
            }
            Q.push({b, c});
          }
        }
      }
    }
  }
L1:
  if (ans.first == -1)
    printf("-1\n");
  else {
    printf("%d\n", L[ans.first][ans.second]);
    printf("1 ");
    while (ans.first != -1) {
      printf("%d ", ans.first);
      ans = pa[ans.first][ans.second];
    }
    printf("\n");
  }
  return 0;
}
