#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1, ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch - '0');
    ch = getchar();
  }
  return f == 1 ? x : -x;
}
inline void print(int a[], int n, int offset) {
  for (int i = 0; i < n; i++) printf("%d ", a[i + offset]);
  printf("\n");
}
const int maxn = 3000 + 10;
const int maxm = 20000 + 10;
const int inf = 1e9;
int n, m, k;
vector<int> e[maxn], forbid[maxm * 2];
pair<int, int> alledge[maxm * 2];
int dis[maxm * 2], fa[maxm * 2];
queue<int> q;
inline int get_edge_id(int x, int y) {
  int id = lower_bound(alledge + 1, alledge + m + 1, make_pair(x, y)) - alledge;
  if (id <= m && alledge[id] == make_pair(x, y)) return id;
  return 0;
}
inline void init() {
  n = read();
  m = read();
  k = read();
  for (int i = 1; i <= m; i++) {
    int u = read(), v = read();
    e[u].push_back(v);
    e[v].push_back(u);
    alledge[i] = make_pair(u, v);
    alledge[i + m] = make_pair(v, u);
  }
  m *= 2;
  sort(alledge + 1, alledge + m + 1);
  for (int i = 1; i <= k; i++) {
    int x = read(), y = read(), z = read(), e1 = get_edge_id(x, y),
        e2 = get_edge_id(y, z);
    if (!e1 || !e2) continue;
    forbid[e1].push_back(e2);
  }
}
inline void doit() {
  for (int i = 1; i <= n; i++) sort(e[i].begin(), e[i].end());
  for (int i = 1; i <= m; i++) sort(forbid[i].begin(), forbid[i].end());
  if (get_edge_id(1, n)) {
    printf("1\n1 %d\n", n);
    return;
  }
  for (int i = 1; i <= m; i++) dis[i] = inf;
  for (int i = 0; i < e[1].size(); i++) {
    int u = e[1][i], id = get_edge_id(1, u);
    dis[id] = 1;
    q.push(id);
  }
  int last = 0;
  while (!q.empty()) {
    int id = q.front(), x = alledge[id].first, y = alledge[id].second;
    q.pop();
    for (int p1 = 0, p2 = 0; p1 < e[y].size(); p1++) {
      int z = e[y][p1];
      while (p2 < forbid[id].size() && alledge[forbid[id][p2]].second < z) p2++;
      if (p2 < forbid[id].size() && alledge[forbid[id][p2]].second == z)
        continue;
      int newid = get_edge_id(y, z);
      if (dis[newid] == inf) {
        dis[newid] = dis[id] + 1;
        q.push(newid);
        fa[newid] = id;
        if (z == n) {
          last = newid;
          break;
        }
      }
    }
    if (last) break;
  }
  if (!last) {
    printf("-1\n");
    return;
  }
  vector<int> ans;
  ans.push_back(n);
  while (1) {
    ans.push_back(alledge[last].first);
    last = fa[last];
    if (!last) break;
  }
  printf("%d\n", (int)ans.size() - 1);
  for (int i = ans.size() - 1; i >= 0; i--) printf("%d ", ans[i]);
  printf("\n");
}
int main() {
  init();
  doit();
  return 0;
}
