#include <bits/stdc++.h>
using namespace std;
map<pair<long long, long long>, pair<long long, long long>> par;
map<pair<long long, pair<long long, long long>>, long long> M;
map<pair<long long, long long>, long long> vis;
map<long long, vector<long long>> adj;
vector<long long> res;
long long n, m, k, v, u, a, b, c;
bool z = true;
void print_path(pair<long long, long long> p) {
  res.push_back(p.second);
  if (p.first == 0) return;
  print_path(par[p]);
}
void bfs() {
  queue<pair<long long, long long>> q;
  q.push({0, 1});
  long long dis = 0, sz = 1;
  for (; q.size() && dis < 1e6; sz = q.size()) {
    while (sz-- && dis < 1e6) {
      pair<long long, long long> u = q.front();
      q.pop();
      dis++;
      for (auto v : adj[u.second]) {
        if (M[{u.first, {u.second, v}}] != 0 || vis[{u.second, v}] == 1)
          continue;
        if (v == n) {
          par[{u.second, v}] = u;
          print_path({u.second, v});
          return;
        }
        par[{u.second, v}] = u;
        q.push({u.second, v});
        vis[{u.second, v}] = 1;
      }
    }
  }
  z = false;
}
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= m; i++) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 1; i <= k; i++) {
    cin >> a >> b >> c;
    M[{a, {b, c}}] = 1;
  }
  bfs();
  if (!z) return cout << -1, 0;
  cout << res.size() - 1 << endl;
  for (int i = res.size() - 1; i >= 0; i--) {
    cout << res[i] << " ";
  }
  return 0;
}
