#include <bits/stdc++.h>
using namespace std;
map<pair<int, pair<int, int>>, int> banned;
map<pair<int, int>, int> vis, path;
int main() {
  int n, m, k, u, v, a, b;
  scanf("%d%d%d", &n, &m, &k);
  vector<int> adj[n + 1];
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  pair<int, int> te;
  for (int i = 0; i < k; i++) {
    scanf("%d%d%d", &u, &v, &m);
    banned[{u, {v, m}}] = 1;
  }
  bool ok = false;
  queue<pair<int, int>> q;
  q.push({0, 1});
  vis[{0, 1}] = 0;
  while (!q.empty()) {
    te = q.front();
    q.pop();
    u = te.first;
    v = te.second;
    if (v == n) {
      ok = true;
      break;
    }
    for (int i = 0; i < adj[v].size(); i++) {
      m = adj[v][i];
      if (!banned[{u, {v, m}}] && !vis[{v, m}]) {
        vis[{v, m}] = vis[{u, v}] + 1;
        q.push({v, m});
        path[{v, m}] = u;
      }
    }
  }
  if (!ok)
    printf("-1\n");
  else {
    printf("%d\n", vis[{u, v}]);
    vector<int> ans;
    m = v;
    v = u;
    while (v != 0 || m != 1) {
      ans.push_back(m);
      u = m;
      m = v;
      v = path[{v, u}];
    }
    ans.push_back(1);
    reverse(ans.begin(), ans.end());
    for (int i = 0; i < ans.size(); i++) printf("%d ", ans[i]);
    printf("\n");
  }
  return 0;
}
