#include <bits/stdc++.h>
using namespace std;
const int M = 3e3 + 4;
const long long N = 1e9;
const long long inf = 1e9;
struct uv {
  int u, v;
};
int n, m, k;
vector<int> adj[M];
set<long long> st;
int dis[M][M];
int pa[M][M];
long long val(long long a1, long long a2, long long a3) {
  return a1 * M * M + a2 * M + a3;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> k;
  while (m--) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  while (k--) {
    int a, b, c;
    cin >> a >> b >> c;
    st.insert(val(a, b, c));
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) dis[i][j] = inf;
  queue<uv> d;
  d.push({1, 0});
  while (!d.empty()) {
    int u = d.front().u;
    int p = d.front().v;
    d.pop();
    for (int v : adj[u])
      if (dis[v][u] == inf && !st.count(val(p, u, v))) {
        dis[v][u] = dis[u][p] + 1;
        pa[v][u] = p;
        d.push({v, u});
      }
  }
  int ans = inf;
  for (int i = 1; i < n; i++) ans = min(ans, dis[n][i]);
  if (ans == inf)
    cout << "-1\n";
  else {
    cout << ans << "\n";
    for (int i = 1; i < n; i++)
      if (ans == dis[n][i]) {
        int u = n, v = i;
        vector<int> r;
        while (u) {
          r.push_back(u);
          swap(u, v);
          v = pa[v][u];
        }
        reverse(r.begin(), r.end());
        for (int x : r) cout << x << " ";
        cout << "\n";
        break;
      }
  }
  return 0;
}
