#include <bits/stdc++.h>
using namespace std;
const int maxn = 3003;
const int inf = 1e9 + 7;
int n, m, k;
int cnt;
vector<int> g[maxn];
vector<int> p[maxn][maxn];
bool inq[maxn];
int dis[maxn][maxn];
int pre[maxn][maxn];
struct node {
  int u, v;
};
int pr, ans;
vector<int> cmp;
void spfa() {
  queue<node> q;
  dis[0][1] = 1;
  q.push((node){0, 1});
  while (!q.empty()) {
    node now = q.front();
    q.pop();
    node nxt;
    nxt.u = now.v;
    int j = 0;
    for (int i = 0; i < g[now.v].size(); i++) {
      nxt.v = g[now.v][i];
      for (; j < p[now.u][now.v].size() && p[now.u][now.v][j] < nxt.v; j++)
        ;
      if (j < p[now.u][now.v].size() && p[now.u][now.v][j] == nxt.v) continue;
      if (dis[nxt.u][nxt.v] == 0) {
        dis[nxt.u][nxt.v] = dis[now.u][now.v] + 1;
        pre[nxt.u][nxt.v] = now.u;
        q.push(nxt);
      }
    }
  }
}
int main() {
  ans = inf;
  int u, v, w;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 0; i < k; i++) {
    scanf("%d %d %d", &u, &v, &w);
    node cmp = (node){u, v};
    p[u][v].push_back(w);
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (p[i][j].size() > 0) sort(p[i][j].begin(), p[i][j].end());
  for (int i = 1; i <= n; i++) sort(g[i].begin(), g[i].end());
  spfa();
  for (int i = 1; i <= n - 1; i++)
    if (dis[i][n] > 0) {
      if (ans > dis[i][n]) {
        pr = i;
        ans = dis[i][n];
      }
    }
  if (ans == inf) {
    printf("-1\n");
    return 0;
  }
  printf("%d\n", ans - 1);
  v = n;
  u = pr;
  while (u != 0) {
    cmp.push_back(u);
    pr = u;
    u = pre[u][v];
    v = pr;
  }
  for (int i = cmp.size() - 1; i >= 0; i--) printf("%d ", cmp[i]);
  printf("%d", n);
  return 0;
}
