#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int N = 3010;
vector<int> v[N];
set<pair<int, int> > vis;
map<pair<int, int>, pair<int, int> > mp;
set<array<int, 3> > s;
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (int i = 0; i < k; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    s.insert({x, y, z});
  }
  queue<array<int, 3> > q;
  q.push({1, 0, 0});
  while (!q.empty()) {
    auto z = q.front();
    q.pop();
    if (z[0] == n) {
      cout << z[2] << '\n';
      pair<int, int> cur = {z[0], z[1]};
      vector<int> pr;
      while (cur.second) {
        pr.push_back(cur.first);
        cur = mp[cur];
      }
      pr.push_back(1);
      reverse(pr.begin(), pr.end());
      for (int x : pr) {
        cout << x << " ";
      }
      cout << '\n';
      return;
    }
    for (int x : v[z[0]]) {
      if (vis.count({x, z[0]}) || s.count({z[1], z[0], x})) continue;
      vis.insert({x, z[0]});
      mp[{x, z[0]}] = {z[0], z[1]};
      q.push({x, z[0], z[2] + 1});
    }
  }
  cout << -1 << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tests = 1;
  while (tests--) {
    solve();
  }
}
