#include <bits/stdc++.h>
using namespace std;
const int MAX = 3010;
const double EPS = 1e-5;
const int INF = INT_MAX;
int d[MAX][MAX];
pair<int, int> p[MAX][MAX];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  memset(d, -1, sizeof d);
  int n, m, k;
  cin >> n >> m >> k;
  vector<vector<int>> g(n + 1);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  set<pair<int, pair<int, int>>> no;
  for (int i = 0; i < k; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    no.insert(pair<int, pair<int, int>>(a, pair<int, int>(b, c)));
  }
  queue<int> q;
  q.push(0);
  q.push(1);
  d[0][1] = 0;
  p[0][1] = pair<int, int>(-1, -1);
  while (q.size()) {
    int x = q.front();
    q.pop();
    int u = q.front();
    q.pop();
    if (u == n) {
      cout << d[x][u] << "\n";
      int a = x, b = u;
      vector<int> ans;
      ans.push_back(u);
      while (b != 1) {
        pair<int, int> &xd = p[a][b];
        a = xd.first;
        b = xd.second;
        ans.push_back(b);
      }
      for (int i = ans.size() - 1; i >= 0; i--) {
        cout << ans[i] << " ";
      }
      return 0;
    }
    pair<int, pair<int, int>> tmp(x, pair<int, int>(u, -1));
    for (auto &v : g[u]) {
      tmp.second.second = v;
      if (no.count(tmp)) continue;
      if (d[u][v] == -1) {
        p[u][v] = pair<int, int>(x, u);
        d[u][v] = d[x][u] + 1;
        q.push(u);
        q.push(v);
      }
    }
  }
  cout << -1;
}
