#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3005;
vector<int> adj[MAXN];
set<int> forbidden[MAXN][MAXN];
bool vis[MAXN][MAXN];
int from[MAXN][MAXN];
int n, m, k;
int pr;
int bfs() {
  queue<pair<int, int>> q;
  q.push({0, 1});
  vis[0][1] = true;
  int steps = 0;
  while (q.size()) {
    int sz = q.size();
    steps++;
    while (sz--) {
      int p = q.front().first;
      int c = q.front().second;
      q.pop();
      for (int i = 0; i < adj[c].size(); i++) {
        int t = adj[c][i];
        if (vis[c][t] || forbidden[p][c].count(t)) continue;
        vis[c][t] = true;
        q.push({c, t});
        from[c][t] = p;
        pr = c;
        if (t == n) return steps;
      }
    }
  }
  return -1;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  while (k--) {
    int a, b, c;
    cin >> a >> b >> c;
    forbidden[a][b].insert(c);
  }
  int steps = bfs();
  if (steps == -1) {
    cout << "-1\n";
    return 0;
  }
  cout << steps << "\n";
  vector<int> path;
  path.push_back(n);
  int cur = n;
  int prev = pr;
  do {
    int temp = from[prev][cur];
    cur = prev;
    prev = temp;
    path.push_back(cur);
  } while (cur != 1);
  while (path.size())
    cout << path.back() << " \n"[path.size() == 1], path.pop_back();
  return 0;
}
