#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 1;
const int inf = 1e9 + 1;
const double eps = 1e-5;
pair<vector<vector<int>>, vector<vector<int>>> dijkstra(
    vector<vector<int>>& adj, set<tuple<int, int, int>>& fobids, int s) {
  int n = adj.size();
  vector<vector<int>> dist(n, vector<int>(n, INF));
  dist[s][s] = 0;
  vector<vector<int>> pre(n, vector<int>(n, -1));
  std::priority_queue<tuple<int, int, int>, vector<tuple<int, int, int>>,
                      greater<tuple<int, int, int>>>
      pq;
  pq.emplace(0, s, s);
  while (pq.size()) {
    auto [dvu, u, v] = pq.top();
    pq.pop();
    if (dvu != dist[v][u]) {
      continue;
    }
    for (int w : adj[v]) {
      if (!fobids.count({u, v, w}) && dist[w][v] > dvu + 1) {
        dist[w][v] = dvu + 1;
        pre[w][v] = u;
        pq.emplace(dist[w][v], v, w);
      }
    }
  }
  return {dist, pre};
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<vector<int>> adj(n);
  set<tuple<int, int, int>> fobids;
  while (m--) {
    int x, y;
    cin >> x >> y;
    --x;
    --y;
    adj[x].emplace_back(y);
    adj[y].emplace_back(x);
  }
  while (k--) {
    int x, y, z;
    cin >> x >> y >> z;
    --x;
    --y;
    --z;
    fobids.emplace(x, y, z);
  }
  auto [dist, pre] = dijkstra(adj, fobids, 0);
  int v = n - 1,
      u = std::min_element(dist[v].begin(), dist[v].end()) - dist[v].begin();
  stack<int> st;
  while (pre[v][u] != -1) {
    st.emplace(v);
    int tmp = u;
    u = pre[v][u];
    v = tmp;
    if (v == 0) {
      st.emplace(v);
      break;
    }
  };
  cout << (st.empty() ? -1 : ((int)st.size() - 1)) << endl;
  while (st.size()) {
    cout << st.top() + 1 << " ";
    st.pop();
  }
}
