#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int main() {
  cin >> n >> m >> k;
  vector<vector<int> > graph(n + 5);
  queue<pair<int, int> > q;
  vector<int> from(n * n, 0);
  for (int i = 0; i < m; i++) {
    int c1, c2;
    cin >> c1 >> c2;
    c1--, c2--;
    graph[c1].push_back(c1 * n + c2);
    graph[c2].push_back(c2 * n + c1);
    if (c1 == 0) {
      q.push(pair<int, int>(1, c1 * n + c2));
      from[c1 * n + c2] = -1;
    } else if (c2 == 0) {
      q.push(pair<int, int>(1, c2 * n + c1));
      from[c2 * n + c1] = -1;
    }
  }
  set<pair<int, int> > forb;
  for (int i = 0; i < k; i++) {
    int c1, c2, c3;
    cin >> c1 >> c2 >> c3;
    c1--, c2--, c3--;
    forb.insert(pair<int, int>(c1 * n + c2, c2 * n + c3));
  }
  int dist = -1;
  int e;
  while (!q.empty()) {
    pair<int, int> p = q.front();
    q.pop();
    if (p.second % n == n - 1) {
      dist = p.first;
      e = p.second;
      break;
    }
    for (int i = 0; i < graph[p.second % n].size(); i++) {
      int c = graph[p.second % n][i];
      if (from[c] != 0) continue;
      if (forb.find(pair<int, int>(p.second, c)) != forb.end()) continue;
      from[c] = p.second;
      q.push(pair<int, int>(p.first + 1, c));
    }
  }
  cout << dist << endl;
  if (dist == -1) {
    return 0;
  }
  vector<int> ans;
  ans.push_back((n - 1) * n);
  while (e != -1) {
    ans.push_back(e);
    e = from[e];
  }
  for (int i = ans.size() - 1; i >= 0; i--) {
    cout << ((ans[i] / n) + 1) << " ";
  }
  cout << endl;
  return 0;
}
