#include <bits/stdc++.h>
using namespace std;
const int maxN = 3000 + 10;
int d[maxN][maxN];
set<pair<pair<int, int>, int> > s;
vector<int> adj[maxN];
pair<int, int> par[maxN][maxN];
void find_path(pair<int, int> cur) {
  if (cur.first == 0) {
    cout << 1 << " ";
    return;
  }
  find_path(par[cur.first][cur.second]);
  cout << cur.second << " ";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    int v, u;
    cin >> v >> u;
    adj[v].push_back(u);
    adj[u].push_back(v);
  }
  for (int i = 0; i < k; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    s.insert(make_pair(make_pair(a, b), c));
  }
  queue<pair<int, int> > q;
  for (int i = 0; i < adj[1].size(); i++) {
    int u = adj[1][i];
    q.push(make_pair(1, u));
    d[1][u] = 1;
  }
  while (q.size()) {
    int v = q.front().first, u = q.front().second;
    q.pop();
    for (int i = 0; i < adj[u].size(); i++) {
      int w = adj[u][i];
      pair<pair<int, int>, int> shit;
      shit.first.first = v, shit.first.second = u, shit.second = w;
      if (s.find(shit) == s.end() && d[u][w] == 0) {
        d[u][w] = d[v][u] + 1;
        par[u][w] = make_pair(v, u);
        q.push(make_pair(u, w));
      }
    }
  }
  int res = 1e9;
  pair<int, int> last;
  for (int i = 1; i <= n; i++)
    if (d[i][n] > 0) {
      if (d[i][n] < res) last = make_pair(i, n);
      res = min(res, d[i][n]);
    }
  if (res == 1e9) return cout << -1 << '\n', 0;
  cout << res << '\n';
  find_path(last);
  return 0;
}
