#include <bits/stdc++.h>
using namespace std;
struct tripl {
  int a, b, c;
  bool operator<(const tripl &nw) const {
    return (a < nw.a || (a == nw.a && b < nw.b) ||
            (a == nw.a && b == nw.b && c < nw.c));
  }
};
const int MM = 20 * 1000 + 10;
const int MK = 1000 * 100 + 10;
const int MN = 3000 + 10;
const int inf = 1 << 30;
vector<tripl> forb;
queue<int> q;
vector<int> sp[MM];
int dp[MN][MN];
int n, m, k;
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    sp[x].push_back(y);
    sp[y].push_back(x);
  }
  for (int i = 0; i < k; i++) {
    tripl w;
    scanf("%d%d%d", &w.a, &w.b, &w.c);
    w.a--;
    w.b--;
    w.c--;
    forb.push_back(w);
  }
  fill(&dp[0][0], &dp[0][0] + MN * MN, inf);
  sort(forb.begin(), forb.end());
  dp[0][0] = 0;
  q.push(0);
  int kol(0);
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    if (v == n - 1) break;
    for (int i = 0; i < sp[v].size(); i++) {
      int p = sp[v][i];
      if (dp[v][p] != inf) continue;
      bool is_push = false;
      for (int i = 0; i < n; i++) {
        if ((i == v && v) || dp[i][v] == inf) continue;
        tripl w;
        w.a = i;
        w.b = v;
        w.c = p;
        bool f = binary_search(forb.begin(), forb.end(), w);
        if (f) continue;
        is_push = true;
        dp[v][p] = min(dp[v][p], dp[i][v] + 1);
      }
      if (is_push) q.push(p);
    }
  }
  int d = inf;
  for (int i = 0; i < n; i++) d = min(d, dp[i][n - 1]);
  if (d == inf)
    cout << -1;
  else {
    cout << d << endl;
    vector<int> ans;
    ans.push_back(n);
    int v = n - 1;
    while (d) {
      for (int i = 0; i < n; i++)
        if (dp[i][v] == d) {
          ans.push_back(i + 1);
          v = i;
          d--;
          break;
        }
    }
    reverse(ans.begin(), ans.end());
    for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  }
  return 0;
}
