#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
const long long P = 31;
const long double EPS = 1e-15;
void scan(int &number) {
  bool negative = false;
  int c;
  number = 0;
  c = getchar();
  if (c == '-') {
    negative = true;
    c = getchar();
  }
  for (; (c > 47 && c < 58); c = getchar()) number = number * 10 + c - 48;
  if (negative) number *= -1;
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  getchar();
  vector<vector<int>> adj(n + 1);
  for (int i = 0; i != m; ++i) {
    int a, b;
    scan(a);
    scan(b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  vector<vector<unordered_set<int>>> taboos(n + 1,
                                            vector<unordered_set<int>>(n + 1));
  for (int i = 0; i != k; ++i) {
    int a, b, c;
    scan(a);
    scan(b);
    scan(c);
    taboos[a][b].insert(c);
  }
  vector<int> used(n + 1);
  vector<vector<int>> trash(n + 1);
  vector<unordered_set<int>> p(n + 1);
  queue<pair<int, vector<int>>> q;
  queue<int> dist;
  queue<vector<int>> path;
  q.push({1, adj[1]});
  dist.push(0);
  path.push({1});
  while (!q.empty() && q.front().first != n) {
    int index = q.front().first;
    int d = dist.front();
    for (auto &i : q.front().second) {
      if (used[i] && trash[i].empty()) continue;
      vector<int> p = path.front();
      if (!used[i]) {
        used[i] = true;
        vector<int> accepted;
        for (auto &j : adj[i]) {
          if (taboos[index][i].find(j) == taboos[index][i].end())
            accepted.push_back(j);
          else
            trash[i].push_back(j);
        }
        q.push({i, accepted});
        dist.push(d + 1);
        p.push_back(i);
        path.push(p);
      } else {
        vector<int> accepted;
        vector<int> tmp;
        for (auto &j : trash[i]) {
          if (taboos[index][i].find(j) != taboos[index][i].end())
            tmp.push_back(j);
          else
            accepted.push_back(j);
        }
        trash[i] = tmp;
        q.push({i, accepted});
        dist.push(d + 1);
        p.push_back(i);
        path.push(p);
      }
    }
    q.pop();
    dist.pop();
    path.pop();
  }
  if (q.front().first != n)
    cout << -1 << '\n';
  else {
    cout << dist.front() << '\n';
    for (int i = 0; i != path.front().size(); ++i)
      cout << path.front()[i] << (i == path.front().size() - 1 ? '\n' : ' ');
  }
  return 0;
}
