#include <bits/stdc++.h>
using namespace std;
long long inf = 1e18;
int const mxn = 3e3 + 10;
queue<pair<long long, long long> > q;
vector<long long> adj[mxn], vec;
long long dis[mxn][mxn];
pair<long long, long long> father[mxn][mxn];
set<pair<long long, pair<long long, long long> > > s;
int findway(int a, int b) {
  if (a == 1) {
    vec.push_back(b);
    vec.push_back(a);
    return 1;
  }
  vec.push_back(b);
  findway(father[a][b].first, father[a][b].second);
}
int n, m, k;
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (int i = 0; i < k; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    s.insert({a, {b, c}});
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j++) dis[i][j] = -1;
  }
  q.push({0, 1});
  dis[0][1] = 0;
  while (q.size()) {
    auto v = q.front();
    q.pop();
    for (auto i : adj[v.second]) {
      if (s.find({v.first, {v.second, i}}) == s.end() and
          dis[v.second][i] == -1) {
        dis[v.second][i] = dis[v.first][v.second] + 1;
        father[v.second][i] = {v.first, v.second};
        q.push({v.second, i});
        if (i == n) {
          cout << dis[v.second][i] << endl;
          findway(v.second, i);
          for (int i = vec.size() - 1; i >= 0; i--) cout << vec[i] << " ";
          return 0;
        }
      }
    }
  }
  cout << -1;
}
