#include <bits/stdc++.h>
using namespace std;
const long long N = 3011;
const long long INF = 1e13;
map<pair<pair<long long, long long>, long long>, bool> trio;
bool ari[N][N];
long long dist[N][N];
pair<long long, long long> parent[N][N];
void dijkstra(long long n) {
  for (long long i = 0; i <= n; i++) {
    for (long long j = 0; j <= n; j++) {
      dist[i][j] = INF;
    }
  }
  priority_queue<pair<long long, pair<long long, long long> > > q;
  for (long long i = 1; i <= n; i++) {
    if (ari[1][i]) {
      dist[1][i] = 1;
      q.push(make_pair(-1, make_pair(1, i)));
    }
  }
  while (!q.empty()) {
    long long pu = q.top().second.first;
    long long u = q.top().second.second;
    long long d_u = -q.top().first;
    q.pop();
    if (d_u != dist[pu][u]) continue;
    for (long long i = 1; i <= n; i++) {
      if (ari[u][i] && dist[u][i] > dist[pu][u] + 1 &&
          !trio[make_pair(make_pair(pu, u), i)]) {
        dist[u][i] = dist[pu][u] + 1;
        parent[u][i] = make_pair(pu, u);
        q.push(make_pair(-dist[u][i], make_pair(u, i)));
      }
    }
  }
  return;
}
void salida(long long pu, long long u) {
  if (pu == 0) {
    printf("1 ");
    return;
  }
  salida(parent[pu][u].first, parent[pu][u].second);
  printf("%lld ", u);
  return;
}
int main() {
  long long n, m, k;
  scanf("%lld %lld %lld", &n, &m, &k);
  long long x, y, z;
  for (long long i = 0; i < m; i++) {
    scanf("%lld %lld", &x, &y);
    ari[x][y] = true;
    ari[y][x] = true;
  }
  for (long long i = 0; i < k; i++) {
    cin >> x >> y >> z;
    trio[make_pair(make_pair(x, y), z)] = true;
  }
  dijkstra(n);
  long long mn = INF;
  long long pos = -1;
  for (long long i = 1; i <= n; i++) {
    if (mn > dist[i][n]) {
      mn = dist[i][n];
      pos = i;
    }
  }
  if (pos == -1) {
    printf("-1\n");
  } else {
    printf("%lld\n", dist[pos][n]);
    salida(pos, n);
  }
  return 0;
}
