#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e3 + 10;
int n, m, k, d[maxn][maxn], mi = 1e9, id;
unordered_map<int, int> mp;
vector<int> g[maxn];
inline int get(int a, int b, int c) { return (133331 * a + 1232 * b + c); }
void bfs() {
  queue<pair<int, int> > q;
  memset(d, -1, sizeof d);
  d[1][1] = 0;
  q.push({1, 1});
  while (q.size()) {
    int u = q.front().first, pre = q.front().second;
    q.pop();
    for (int to : g[u]) {
      if (d[to][u] == -1 && !mp.count(get(pre, u, to))) {
        d[to][u] = d[u][pre] + 1;
        q.push({to, u});
      }
    }
  }
}
void ppath(int x, int pre) {
  if (x != 1 || pre != 1) {
    for (int i = 1; i <= n; i++)
      if (d[pre][i] == d[x][pre] - 1) {
        ppath(pre, i);
        break;
      }
  }
  cout << x << " ";
}
signed main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= m; i++) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 1; i <= k; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    mp[get(a, b, c)] = 1;
  }
  bfs();
  for (int i = 1; i <= n; i++)
    if (d[n][i] != -1 && d[n][i] < mi) mi = d[n][i], id = i;
  if (!id) return puts("-1"), 0;
  cout << d[n][id] << endl;
  ppath(n, id);
  return 0;
}
