#include <bits/stdc++.h>
using namespace std;
int constexpr maxn = 3e3 + 10;
int n, m, k;
bool seen[maxn][maxn];
vector<int> g[maxn];
vector<pair<int, int> > bfs;
vector<pair<int, int> > p[maxn];
set<pair<int, pair<int, int> > > st;
void fnd(pair<int, int> x) {
  int v = x.second;
  if (v == -1) return;
  for (pair<int, int> i : p[v])
    if (i.second == x.first) {
      fnd(i);
      cout << v + 1 << ' ';
      return;
    }
}
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    int u, v, w;
    cin >> u >> v;
    u--;
    v--;
    g[u].emplace_back(v);
    g[v].emplace_back(u);
  }
  for (int i = 0; i < k; i++) {
    int u, v, w;
    cin >> u >> v >> w;
    u--;
    v--;
    w--;
    st.insert(pair<int, pair<int, int> >(u, pair<int, int>(v, w)));
  }
  p[0].emplace_back(pair<int, int>(-1, -1));
  bfs.emplace_back(pair<int, int>(-1, 0));
  for (int i = 0, lvl = 0; i < bfs.size(); lvl++)
    for (int j = bfs.size(); i < j; i++) {
      int u = bfs[i].second;
      int tmpar = bfs[i].first;
      if (u == n - 1) {
        cout << lvl << '\n';
        fnd(bfs[i]);
        return 0;
      }
      for (int v : g[u])
        if (st.find(pair<int, pair<int, int> >(tmpar, pair<int, int>(u, v))) ==
            st.end()) {
          if (!seen[u][v]) {
            seen[u][v] = true;
            bfs.emplace_back(pair<int, int>(u, v));
          }
          p[v].emplace_back(pair<int, int>(tmpar, u));
        }
    }
  cout << -1 << '\n';
  return 0;
}
