#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3010;
vector<int> g[MAXN];
long long dist[MAXN][MAXN], par[MAXN][MAXN], vis[MAXN][MAXN];
struct node {
  int a, b, c;
  node() : a(0), b(0), c(0) {}
  node(int a, int b, int c) : a(a), b(b), c(c) {}
  bool operator==(node w) { return (w.a == a && w.b == b && w.c == c); }
  bool operator<(node w) const {
    if (w.a != a) return a < w.a;
    if (w.b != b) return b < w.b;
    return c < w.c;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  set<node> t;
  for (long long i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (long long i = 0; i < k; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    c--;
    t.insert(node(a, b, c));
  }
  memset(vis, 0, sizeof(vis));
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < n; j++) dist[i][j] = 1e9;
  queue<pair<int, int>> q;
  q.push({0, 0});
  dist[0][0] = 0;
  par[0][0] = -1;
  vis[0][0] = 1;
  while (((int)(q).size())) {
    int u = q.front().first, last = q.front().second;
    q.pop();
    for (auto v : g[u]) {
      if (!vis[v][u] && dist[v][u] > dist[u][last] + 1 &&
          !t.count(node(last, u, v))) {
        dist[v][u] = dist[u][last] + 1;
        par[v][u] = last;
        vis[v][u] = 1;
        q.push({v, u});
      }
    }
  }
  long long ans = 1e9, curr = n - 1, last;
  for (long long i = 0; i < n - 1; i++) {
    if (dist[n - 1][i] < ans) {
      ans = dist[n - 1][i];
      last = i;
    }
  }
  if (ans >= 1e9) {
    cout << "-1\n";
    return 0;
  }
  cout << ans << "\n";
  vector<int> res;
  while (curr != -1) {
    res.push_back(curr + 1);
    int t = last;
    last = par[curr][last];
    curr = t;
  }
  res.pop_back();
  reverse(res.begin(), res.end());
  for (auto r : res) cout << r << " ";
  return 0;
}
