#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T sqr(const T &a) {
  return a * a;
}
template <typename T>
inline int nread(vector<T> &a) {
  int n;
  cin >> n;
  a.clear();
  a.resize(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  return n;
}
template <typename T>
inline void nwread(int n, vector<T> &a) {
  a.clear();
  a.resize(n);
  for (int i = 0; i < n; i++) cin >> a[i];
}
const int N = 3001;
int gr[N][N], cg[N];
int res[N * N];
pair<int, int> que[N * N];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) cg[i] = 0;
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    x--;
    y--;
    gr[x][cg[x]++] = y;
    gr[y][cg[y]++] = x;
  }
  set<pair<pair<int, int>, int> > zapr;
  for (int i = 0; i < k; i++) {
    int x, y, z;
    scanf("%d%d%d", &x, &y, &z);
    x--;
    y--;
    z--;
    zapr.insert(make_pair(make_pair(x, y), z));
  }
  map<pair<int, int>, int> path;
  int qi = 0, qj = 1;
  que[0] = make_pair(-1, 0);
  while (qi < qj) {
    pair<int, int> tek = que[qi++];
    int pv = tek.first, tv = tek.second;
    vector<int> nreb;
    for (int i = 0; i < cg[tv];) {
      int fv = gr[tv][i];
      if (zapr.count(make_pair(tek, fv)))
        i++;
      else {
        que[qj++] = make_pair(tv, fv);
        path[make_pair(tv, fv)] = pv;
        if (fv == n - 1) {
          int lr = 2;
          res[0] = fv;
          res[1] = tv;
          while (tv != 0) {
            pv = path[make_pair(tv, fv)];
            res[lr++] = pv;
            fv = tv;
            tv = pv;
          }
          reverse(res, res + lr);
          cout << lr - 1 << endl;
          for (int i = 0; i < lr; i++) printf("%d ", res[i] + 1);
          return 0;
        }
        if (cg[tv]) gr[tv][i] = gr[tv][cg[tv] - 1];
        cg[tv]--;
      }
    }
  }
  cout << -1;
}
