#include <bits/stdc++.h>
using namespace std;
vector<int> adj[3010];
int n, m, k;
int t1, t2, t3;
int p[3010][3010];
map<pair<pair<int, int>, int>, int> mp;
void dj() {
  pair<int, int> ans = {-1, -1};
  queue<pair<int, int>> q;
  q.push({1, 1});
  while (!(q.empty())) {
    pair<int, int> v = q.front();
    q.pop();
    if (v.second == n) {
      ans = v;
      break;
    }
    for (int i : adj[v.second]) {
      if (mp[{v, i}]) continue;
      if (p[v.second][i]) continue;
      p[v.second][i] = v.first;
      q.push({v.second, i});
    }
  }
  if (ans.first == -1)
    cout << "-1\n";
  else {
    vector<int> path;
    while (ans.second != 1) {
      path.push_back(ans.second);
      ans = {p[ans.first][ans.second], ans.first};
    }
    int pl = path.size();
    cout << pl << "\n";
    reverse(path.begin(), path.end());
    cout << "1 ";
    for (auto &&it : path) cout << it << " ";
    cout << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> k;
  int temp = 0;
  while (temp < m) {
    cin >> t1 >> t2;
    adj[t1].push_back(t2);
    adj[t2].push_back(t1);
    temp++;
  }
  temp = 0;
  while (temp < k) {
    cin >> t1 >> t2 >> t3;
    mp[{{t1, t2}, t3}]++;
    temp++;
  }
  dj();
  return 0;
}
