#include <bits/stdc++.h>
using namespace std;
vector<int> con[3005];
set<int> se[3005];
struct edge {
  int u, v, w;
  edge() : u(0), v(0), w(0) {}
  edge(int u, int v, int w) : u(u), v(v), w(w) {}
};
int n, pre[3005][3005];
void pri(int p, int p1) {
  if (pre[p][p1] < 0) {
    printf("%d ", p1);
    return;
  }
  pri(pre[p][p1], p);
  printf("%d ", p1);
}
void solve() {
  int p, p1, j, v;
  edge ed;
  queue<edge> Q;
  Q.push(edge(0, 1, 0));
  memset(pre, -1, sizeof(pre));
  pre[0][1] = -2;
  while (!Q.empty()) {
    ed = Q.front();
    Q.pop();
    p = ed.u;
    p1 = ed.v;
    if (p1 == n) break;
    for (j = 0; j < con[p1].size(); j++) {
      v = con[p1][j];
      if (pre[p1][v] != -1 || se[p].count(3005 * p1 + v)) continue;
      pre[p1][v] = p;
      Q.push(edge(p1, v, ed.w + 1));
    }
  }
  if (p1 == n) {
    printf("%d\n", ed.w);
    pri(pre[p][p1], p);
    printf("%d", p1);
  } else
    printf("-1");
}
int main() {
  int s, t, a1, b1, c1, i, m, k;
  while (scanf("%d %d %d\n", &n, &m, &k) == 3) {
    for (i = 0; i < n; i++) con[i].clear();
    for (i = 0; i < m; i++) {
      scanf("%d %d\n", &s, &t);
      con[s].push_back(t);
      con[t].push_back(s);
    }
    for (i = 0; i < k; i++) {
      scanf("%d %d %d\n", &a1, &b1, &c1);
      se[a1].insert(b1 * 3005 + c1);
    }
    solve();
  }
  return 0;
}
