#include <bits/stdc++.h>
using namespace std;
int t, tt, n, N, l, r, c, cnt, L, R, C, m, k, mn = 1e9 + 9, mx = 0, height,
                                              width, u, v;
long long ans, s, p, q;
bool check = false;
vector<int> adj[3009];
set<pair<int, int>> bad[3009];
int dist[3009][3009], par[3009][3009], path[3009], pathNo;
void bfs() {
  queue<pair<int, int>> Q;
  Q.push({1, 0});
  dist[1][0] = 0;
  while (!Q.empty()) {
    u = Q.front().first;
    v = Q.front().second;
    Q.pop();
    if (u == n) return;
    for (int x : adj[u]) {
      if (bad[v].count({u, x}) || dist[u][x]) continue;
      dist[u][x] = 1 + dist[v][u];
      par[u][x] = v;
      Q.push({x, u});
    }
  }
  cout << "-1\n";
  exit(0);
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cin >> n >> m >> k;
  while (m--) {
    cin >> t >> tt;
    adj[t].push_back(tt), adj[tt].push_back(t);
  }
  while (k--) {
    int t1, t2, t3;
    cin >> t1 >> t2 >> t3;
    bad[t1].insert({t2, t3});
  }
  bfs();
  path[pathNo++] = u;
  while (v != 0) {
    int tmp = v;
    v = par[v][u];
    u = tmp;
    path[pathNo++] = u;
  }
  cout << pathNo - 1 << endl;
  while (--pathNo) cout << path[pathNo] << ' ';
  cout << path[0] << endl;
  return 0;
}
