#include <bits/stdc++.h>
using namespace std;
vector<int> v[3001];
int size1[3001];
map<vector<int>, int> mm;
long dis[3001][3001];
void dijkstra(int n) {
  priority_queue<vector<int>> pq;
  vector<int> p(3, 0), p1(3);
  p[0] = 0;
  p[2] = 1;
  pq.push(p);
  long size = 1;
  while (size) {
    p = pq.top();
    pq.pop();
    --size;
    if ((dis[p[2]][p[1]] > p[0]) && (dis[p[2]][p[1]] != 0)) {
      continue;
    }
    if (p[2] == n) return;
    for (int i = 0; i < size1[p[2]]; ++i) {
      p1[0] = p[1];
      p1[1] = p[2];
      p1[2] = v[p[2]][i];
      if (mm[p1] == 1) continue;
      if ((dis[p1[2]][p1[1]] < dis[p[2]][p[1]] - 1) ||
          (dis[p1[2]][p1[1]] == 0)) {
        dis[p1[2]][p1[1]] = dis[p[2]][p[1]] - 1;
        p1[0] = dis[p1[2]][p1[1]];
        pq.push(p1);
        ++size;
        if ((p1[2] == n) && (p1[0] == -1)) return;
      }
    }
  }
}
int main() {
  int n, m, a, b, c, k;
  cin >> n >> m >> k;
  vector<int> arr(3);
  for (int i = 0; i < m; ++i) {
    scanf("%d %d", &a, &b);
    v[a].emplace_back(b);
    size1[a]++;
    v[b].emplace_back(a);
    size1[b]++;
  }
  for (int i = 0; i < k; ++i) {
    scanf("%d %d %d", &arr[0], &arr[1], &arr[2]);
    mm[arr] = 1;
  }
  dijkstra(n);
  long maxim = 0;
  int maximindex = 0;
  for (int i = 1; i <= n; ++i) {
    if (dis[n][i] == 0) {
      continue;
    }
    if ((dis[n][i] > maxim) || (maxim == 0)) {
      maxim = dis[n][i];
      maximindex = i;
    }
  }
  if (maxim == 0) {
    cout << "-1" << endl;
    return 0;
  }
  int i = n;
  int j = maximindex;
  stack<int> s;
  s.push(i);
  long ans = 1;
  int size2 = 1;
  i = maximindex;
  maxim++;
  while (maxim < 0) {
    for (int j = 1; j <= n; ++j) {
      if (dis[i][j] == 0) continue;
      if (dis[i][j] == maxim) {
        maximindex = j;
        break;
      }
    }
    ++ans;
    s.push(i);
    ++size2;
    maxim++;
    i = maximindex;
  }
  cout << ans << endl;
  cout << "1"
       << " ";
  while (size2) {
    printf("%d ", s.top());
    s.pop();
    --size2;
  }
  return 0;
}
