#include <bits/stdc++.h>
using namespace std;
vector<int> neibs[3001];
map<pair<pair<int, int>, int>, bool> ban;
bool been[3001][3001];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  while (m--) {
    int x, y;
    cin >> x >> y;
    neibs[x].push_back(y);
    neibs[y].push_back(x);
  }
  while (k--) {
    int a, b, c;
    cin >> a >> b >> c;
    ban[{{a, b}, c}] = ban[{{c, b}, a}] = 1;
  }
  queue<pair<pair<int, int>, vector<int>>> q;
  q.push({{-1, 1}, {1}});
  vector<int> ans;
  while (!q.empty()) {
    int a = q.front().first.first, b = q.front().first.second;
    vector<int> road = q.front().second;
    if (b == n) {
      ans = road;
      break;
    }
    q.pop();
    for (int c : neibs[b]) {
      if (!ban[{{a, b}, c}] && !been[b][c]) {
        been[b][c] = 1;
        road.push_back(c);
        q.push({{b, c}, road});
        road.pop_back();
      }
    }
  }
  if (ans.empty())
    cout << "-1\n";
  else {
    cout << ans.size() - 1 << "\n";
    for (int a : ans) cout << a << " ";
    cout << "\n";
  }
  return 0;
}
