#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T MAX(T a, T b) {
  if (a > b) return a;
  return b;
}
template <class T>
inline T MIN(T a, T b) {
  if (a < b) return a;
  return b;
}
template <class T>
inline T ABS(T x) {
  if (x < 0) return -x;
  return x;
}
inline void OPEN(const string &s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
const static int INF = 1000000000;
int n, m, k, a, b, c;
vector<vector<int> > ver(3005);
set<pair<pair<int, int>, int> > gak;
int dis[3005] = {};
set<pair<pair<int, int>, int> > visited;
set<pair<int, int> > dua;
vector<int> cal(int s, int t) {
  for (int(i) = (1); (i) <= (t); ++(i)) dis[i] = INF;
  vector<vector<int> > path(3005);
  priority_queue<pair<pair<int, int>, vector<int> >,
                 vector<pair<pair<int, int>, vector<int> > >,
                 greater<pair<pair<int, int>, vector<int> > > >
      q;
  vector<int> temp;
  temp.push_back(s);
  path[s].push_back(s);
  q.push(make_pair(make_pair(0, s), temp));
  dis[s] = 0;
  pair<pair<int, int>, vector<int> > now;
  while (!q.empty()) {
    now = q.top();
    q.pop();
    int w = now.first.second;
    vector<int> tempPath = now.second;
    for (int(i) = (0); (i) < (ver[w].size()); ++(i)) {
      int v = ver[w][i];
      pair<pair<int, int>, int> cek;
      cek.first.first = cek.first.second = cek.second = 0;
      int len = tempPath.size();
      int awal;
      if (len >= 2)
        awal = len - 2;
      else
        awal = 0;
      for (int k = awal, j = 0; k < tempPath.size(); k++, j++) {
        if (j == 0)
          cek.first.first = tempPath[k];
        else
          cek.first.second = tempPath[k];
      }
      if (len >= 2)
        cek.second = v;
      else if (len == 1)
        cek.first.second = v;
      else
        cek.first.first = v;
      if (gak.find(cek) == gak.end()) {
        if (dua.find(make_pair(w, v)) != dua.end()) continue;
        dua.insert(make_pair(cek.first.second, cek.second));
        if (v != t || (v == t && dis[v] > now.first.first + 1)) {
          dis[v] = now.first.first + 1;
          path[v] = tempPath;
          path[v].push_back(v);
          q.push(make_pair(make_pair(dis[v], v), path[v]));
        }
      }
    }
  }
  return path[t];
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int(i) = (0); (i) < (m); ++(i)) {
    scanf("%d%d", &a, &b);
    ver[a].push_back(b);
    ver[b].push_back(a);
  }
  for (int(i) = (0); (i) < (k); ++(i)) {
    scanf("%d%d%d", &a, &b, &c);
    gak.insert(make_pair(make_pair(a, b), c));
  }
  vector<int> path = cal(1, n);
  if (dis[n] == INF)
    printf("-1\n");
  else {
    printf("%d\n", path.size() - 1);
    for (int(i) = (0); (i) < (path.size()); ++(i)) {
      if (i != 0) printf(" ");
      printf("%d", path[i]);
    }
    printf("\n");
  }
  return 0;
}
