#include <bits/stdc++.h>
using namespace std;
template <typename Tp>
inline void read(Tp &x) {
  static bool neg;
  static char c;
  x = 0, neg = 0, c = getchar();
  for (; !isdigit(c); c = getchar()) {
    if (c == '-') {
      neg = 1;
    }
  }
  for (; isdigit(c); c = getchar()) {
    x = x * 10 + c - '0';
  }
  if (neg) {
    x = -x;
  }
}
const int INF = 0x3f3f3f3f;
const int N = 3e3 + 5;
const int M = 2e4 + 5;
const int K = 1e5 + 5;
int vis[N][N], dp[N][N];
int n, m, k;
int head[N], E = 0;
struct Edge {
  int to, next;
} e[M * 2];
inline void addEdge(int u, int v) {
  e[++E] = (Edge){v, head[u]};
  head[u] = E;
}
namespace Trie {
unordered_map<int, unordered_map<int, unordered_set<int>>> store;
inline void set(int a, int b, int c) { store[a][b].insert(c); }
inline bool get(int a, int b, int c) { return (bool)store[a][b].count(c); }
}  // namespace Trie
int main() {
  read(n), read(m), read(k);
  for (int i = 0, u, v; i < m; ++i) {
    read(u), read(v);
    addEdge(u, v);
    addEdge(v, u);
  }
  for (int i = 0, a, b, c; i < k; ++i) {
    read(a), read(b), read(c);
    Trie::set(a, b, c);
  }
  memset(vis, -1, sizeof(vis));
  memset(dp, 0x3f, sizeof(dp));
  dp[0][1] = 0;
  queue<pair<int, int>> q;
  q.emplace((pair<int, int>){0, 1});
  while (!q.empty()) {
    pair<int, int> u = q.front();
    q.pop();
    int a = u.first, b = u.second, c;
    for (int i = head[b]; i; i = e[i].next) {
      c = e[i].to;
      if (vis[b][c] == -1) {
        if (!Trie::get(a, b, c)) {
          vis[b][c] = a;
          dp[b][c] = dp[a][b] + 1;
          q.emplace((pair<int, int>){b, c});
        }
      }
    }
  }
  int ans = INF, ansPos;
  for (int i = 1; i <= n; ++i) {
    if (dp[i][n] < ans) {
      ans = dp[i][n];
      ansPos = i;
    }
  }
  if (ans == INF) {
    puts("-1");
    return 0;
  } else {
    printf("%d\n", ans);
    vector<int> vec;
    vec.emplace_back(n);
    vec.emplace_back(ansPos);
    int u = ansPos, v = n;
    while (u != 1) {
      int t = v;
      v = u;
      u = vis[u][t];
      vec.emplace_back(u);
    }
    for (auto it = vec.rbegin(); it != vec.rend(); ++it) {
      printf("%d ", *it);
    }
  }
}
