#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, m, k;
set<int> edge[3001];
map<pair<int, int>, set<int>> forb;
int d[3001][2], pre[3001][2], cnt[3001];
void bfs() {
  queue<pair<int, int>> q;
  q.push({1, 0});
  while (q.size()) {
    int cur = q.front().first, from = q.front().second;
    q.pop();
    set<int> leftover;
    for (int i : edge[cur]) {
      if (i == 1) continue;
      int nodefrom = pre[cur][from];
      if (edge[i].size() && cnt[i] < 2 && cnt[0] != cur) {
        if (nodefrom > 0) {
          set<int> ss = forb[{nodefrom, cur}];
          if (ss.find(i) != ss.end()) {
            leftover.insert(i);
            continue;
          }
        }
        pre[i][cnt[i]] = cur;
        d[i][cnt[i]] = d[cur][from] + 1;
        q.push({i, cnt[i]});
        cnt[i]++;
      }
    }
    edge[cur] = leftover;
  }
  if (d[n][0])
    cout << d[n][0] << endl;
  else {
    printf("-1");
    return;
  }
  int dist = d[n][0];
  vector<int> sol;
  int v = n;
  while (v != 1) {
    sol.push_back(v);
    if (d[v][0] == dist) {
      v = pre[v][0];
    } else
      v = pre[v][1];
    dist--;
  }
  sol.push_back(v);
  for (int i = sol.size() - 1; i >= 0; i--) printf("%d ", sol[i]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m >> k;
  int x, y, z;
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    edge[x].insert(y);
    edge[y].insert(x);
  }
  for (int i = 0; i < k; i++) {
    cin >> x >> y >> z;
    forb[{x, y}].insert(z);
  }
  bfs();
  return 0;
}
