#include <bits/stdc++.h>
using namespace std;
const int maxn = 3000 + 10;
int ans[maxn][maxn];
int N, M, K;
set<pair<pair<int, int>, int> > seti;
queue<pair<int, int> > qu;
vector<int> ve[maxn];
pair<int, int> prv[maxn][maxn];
void BFS() {
  ans[0][0] = 1;
  prv[0][0] = make_pair(0, 0);
  qu.push(make_pair(0, 0));
  while (qu.size() > 0) {
    pair<int, int> id = qu.front();
    qu.pop();
    for (int i = 0; i < ve[id.second].size(); i++) {
      if (seti.find(make_pair(make_pair(id.first, id.second),
                              ve[id.second][i])) == seti.end() &&
          ans[id.second][ve[id.second][i]] == 0) {
        ans[id.second][ve[id.second][i]] = ans[id.first][id.second] + 1;
        prv[id.second][ve[id.second][i]] = make_pair(id.first, id.second);
        qu.push(make_pair(id.second, ve[id.second][i]));
      }
    }
  }
}
int main() {
  cin >> N >> M >> K;
  while (M--) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    ve[u].push_back(v), ve[v].push_back(u);
  }
  while (K--) {
    int a, b, c;
    cin >> a >> b >> c;
    a--, b--, c--;
    seti.insert(make_pair(make_pair(a, b), c));
  }
  BFS();
  for (int i = 0; i < N; i++) ve[i].clear();
  int way = 1000 * 1000 * 1000;
  int fir = -1, sec = -1;
  for (int i = 0; i < N; i++) {
    if (ans[i][N - 1] != 0 && ans[i][N - 1] < way) {
      fir = i, sec = N - 1;
      way = ans[i][N - 1];
    }
  }
  if (fir == -1) {
    cout << -1;
    return 0;
  }
  cout << way - 1 << "\n";
  vector<int> path;
  while (fir != 0 && (way--) > 0) {
    path.push_back(sec);
    pair<int, int> prev = prv[fir][sec];
    sec = prev.second;
    fir = prev.first;
  }
  if (sec != 0) path.push_back(sec);
  path.push_back(fir);
  while (path.size() > 0) {
    cout << path.back() + 1 << " ";
    path.pop_back();
  }
}
