#include <bits/stdc++.h>
const int mx = 1e6 + 5;
const int inf = 0x3f3f3f3f;
using namespace std;
int n, m, k;
vector<vector<int>> g;
vector<int> p;
int parent[3001][3001];
map<pair<pair<int, int>, int>, int> forb;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  memset(parent, 0, sizeof(parent));
  scanf("%d%d%d", &n, &m, &k);
  g.resize(n + 1);
  for (int i = 0; i < m; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    g[a].push_back(b);
    g[b].push_back(a);
  }
  queue<pair<int, int>> q;
  for (int i = 0; i < k; ++i) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    ++forb[{{a, b}, c}];
  }
  q.push({1, 1});
  pair<int, int> ans = {-1, -1};
  while (!q.empty()) {
    pair<int, int> u = q.front();
    q.pop();
    if (u.second == n) {
      ans = u;
      break;
    }
    for (auto v : g[u.second]) {
      if (forb[{u, v}] || parent[u.second][v]) continue;
      parent[u.second][v] = u.first;
      q.push({u.second, v});
    }
  }
  if (ans == make_pair(-1, -1)) {
    puts("-1");
    return 0;
  }
  vector<int> p;
  while (ans.second != 1) {
    p.push_back(ans.second);
    ans = {parent[ans.first][ans.second], ans.first};
  }
  printf("%d\n1 ", int(p.size()));
  reverse(p.begin(), p.end());
  for (auto e : p) printf("%d ", e);
  puts("");
  return 0;
}
